vue中compute、watch区别

969 阅读1分钟

1.只给计算属性一个函数,在取值时触发(get)阶段

compute:{
    getCheck:{
        get(){
            console.log('取值')
        },
        set(newVal){
            console.log('设置值')
        }
    }
}