美文网首页
vue 之 watch + computed 搭档

vue 之 watch + computed 搭档

作者: 一只鱼_d589 | 来源:发表于2020-09-22 15:25 被阅读0次

有时候watch监听不到数据,需要跟computed配合

watch: {
    A() {
    }
    B() {
    }
    changeDate: {
        handler: function(val, oldval) {
            if(val.A && val.B) { 操作}
        }
    }
}

computed: {
    changeDate() {
        const {A, B} = this;
        return {
          A,
          B
         }
    }
}

相关文章

网友评论

      本文标题:vue 之 watch + computed 搭档

      本文链接:https://www.haomeiwen.com/subject/sruwyktx.html