触发监听执行多个方法
【触发监听执行多个方法】当我们触发监听执行多个方法时,使用数组可以设置多项,形式包括字符串、函数、对象
export default {
data: {
name: 'jane'
},
watch: {
name: [
'sayName1',
function(newVal, oldVal) {
this.sayName2()
},
{
handler: 'sayName3',
immaediate: true
}
]
},
methods: {
sayName1() {
console.log('sayName1==>', this.name)
},
sayName2() {
console.log('sayName2==>', this.name)
},
sayName3() {
console.log('sayName3==>', this.name)
}
}
}
推荐阅读
- CVE-2020-16898|CVE-2020-16898 TCP/IP远程代码执行漏洞
- 字符串拼接成段落,换行符(\n)如何只执行n-1次
- Quartz|Quartz 源码解析(四) —— QuartzScheduler和Listener事件监听
- R语言|R语言 函数
- vue_day05
- 高效执行力第六课-小结
- 成功通航(用宜搭提升数字化管理效能,确保每次飞行任务安全执行)
- @逆战千锋|@逆战千锋 为什么sql语句执行之后表单中没有数据
- Spring|Spring Aop常见注解与执行顺序详解
- 什么叫思辨的执行