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


  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM