vue watch 監聽多個值


用computed定義一個address對象吧,然后再去watch addres

data() {
  return {
    check: false,
    sign_img: "",
    submit_flag: false'
  }
},
computed: {
  btnObj() {
    const { sign_img, check } = this
    return {
      sign_img,
      check
    }
  }
},
watch: {
  btnObj: {
    handler: function(newVal,oldVal) {
      if(!!this.sign_img && this.check){
        this.submit_flag = true
        this.sign_flag = '1'
      }else{
        this.submit_flag = false
        this.sign_flag = '0'
      }
    },
    deep: true,
    immediate: true
  }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM