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

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

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);
        },

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


  

posted @ 2019-04-04 17:33  CorderBob  阅读(1673)  评论(0编辑  收藏  举报