iview 开关变化时控制状态的变动

1.css
.switch{
 pointer-events:none
}css

2.js
var App = new Vue({
  template: '<i-switch @click="change" :value="open"class="switch" ></i-switch>',
  data(){
    return {
      open:false
    }
  },
  methods:{
    change(open){
      this.$Modal.confirm({
        title: '切换提示',
        content: '<p>开关状态即将发生更改,是否继续</p>',
        onOk: () => {
          this.open = true;
          this.$Message.info('当前状态是'+ this.open);
        },this

        onCancel:()=>{
          this.open = false;
          this.$Message.info('当前状态是'+ this.open);
        }
      });
    }
  }
});
  it

相关文章
相关标签/搜索