// components/mp-switch/mp-switch.js
Component({
    properties: {
        trueText: {
            type: String,
            value: '开'
        },
        falseText: {
            type: String,
            value: '关'
        },
        // 传进来的对象
        item: {
            type: Object,
            value: {}
        },
        width: {
            type: Number,
            value: 72
        },
        height: {
            type: Number,
            value: 32
        }
    },
    methods: {
        onChange() {
          console.log(this.data.item);
            this.setData({
                checked: !this.data.item.checked
            }, () => {
                this.triggerEvent('change', {
                    value: this.data.item
                })
            })
        }
    }
})