vue中watch深度监听

监听基本类型的都是浅度监听
watch的深度监听,监听复杂类型都是深度监听(funciton ,arrat ,object)
//    监听对象
data(){
    return {
        a:{
            b:10,
            c:20
        }
    }
},
    watch:{
        a:{
            handler(a,b,c){
                console.log(a)
                console.log(b)
            },
                deep:true // 必须加这个属性
        }

 

posted @ 2019-10-20 11:01  前端伪大叔  阅读(4821)  评论(0编辑  收藏  举报