modal.js 647 Bytes
// components/modal/modal.js

Component({
  properties: {
    position: { 
      type: String, 
      value: 'center', 
      observer: function (newVal, oldVal) { }
    },
    title: {
      type: String,
      value: '',
      observer: function (newVal, oldVal) { }
    },
    hidden: Boolean,
    type: {
      type: String,
      value: 'alert',
      observer: function (newVal, oldVal) { }
    },
    closeApp:Boolean
  },
  data: {},
  methods: {
    confirm: function (e) {
      this.setData({
        hidden: true
      });
      this.triggerEvent('close', {
        isConfirm: !!e.currentTarget.dataset.isConfirm
      });
    }
  }
})