// components/confirm/confirm.ts
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    title: {
      type: String,
      value: ''
    },
    message: {
      type: String,
      value: ''
    },
    confirmText: {
      type: String,
      value: ''
    },
    cancelText: {
      type: String,
      value: ''
    },
    confirmShow: {
      type: Boolean,
      value: true
    },
    cancelShow: {
      type: Boolean,
      value: true
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    visible: false
  },

  /**
   * 组件的方法列表
   */
  methods: {
    confirm() {
      this.triggerEvent('confirm')
      this.hidden()
    },
    cencel() {
      this.triggerEvent('cancel')
      this.hidden()
    },
    close() {
      this.triggerEvent('close')
      this.hidden()
    },
    show() {
      this.setData({
        visible: true
      })
    },
    hidden() {
      this.setData({
        visible: false
      })
    }
  }
})
