props: {
example: {
type: Object,
default() {
},
},
},
watch: {
example: function(newVal,oldVal){ // newVal 为改变后的值
// 继续要处理的事件
},
},
使用watch 替代 mounted。
通过watch属性来响应数据的变化,当数据改变时执行异步操作。
更多专业前端知识,请上
【猿2048】www.mk2048.com
转载请注明原文地址: https://mac.8miu.com/read-55060.html