uniapp 使用 watch 监听属性的变化

<input type="text" v-model="propName"/>  


watch: {
    propName: {
        handler (newVal, oldVal) {
            console.log(newVal)
        },
        immediate: true  //设置为 true 时,第一次进入页面时即监听;false时刚进入页面不监听,仅在值发生变化时监听
    }
}

猜你喜欢

转载自blog.csdn.net/dd2016124/article/details/119728182