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