使用watch监听路由变化和watch监听对象
来源:互联网 发布:网侠安卓电视直播软件 编辑:程序博客网 时间:2024/06/05 06:34
一、watch监听路由变化
解决办法:
export default{
data(){
return{}
},
watch:{
"$route":"getPath" // 监听事件
},
methods:{
getPath(){
let path = this.$roune.path; //或得当前路径
进行逻辑判断
}
}
}
二、watch监听对象
例子:
<el-select v-model="form.region" placeholder="请选择">
<el-option
v-for="item in rootCategory" :key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
export default{
data(){
return{
form:{
region:""
}
}
},
watch:{
'form.region':function(newValue,oldValue){
console.info(newValue);
console.info(oldValue);
}
}
}
阅读全文
0 0
- 使用watch监听路由变化和watch监听对象
- angularjs $watch监听模型变化
- $watch监听多个值的变化
- vue watch监听对象及对应值的变化
- Angular.js中使用$watch监听模型变化
- Angular中使用$watch监听object属性值的变化
- Angular.js中使用$watch监听模型变化
- Angular.js中使用$watch监听模型变化
- Angular.js中使用$watch监听模型变化
- Angular.js中使用$watch监听模型变化
- Angular.js中使用$watch监听模型变化
- Angular.js中使用$watch监听模型变化 (转载)
- ANGULAR JS WATCH监听使用
- 使用watch监听input值
- angularjs 用$watch监听模型变化
- 如何安装和使用+Http+Watch+服务器+监听工具+【上】
- GO ZK WATCH监听
- angular的watch监听
- Java并发编程:volatile关键字解析
- App的启动过程(6)面向应用程序的本地窗口surface
- 柱状图跟饼图
- Android UI 之 RecyclerView实现常见首页布局
- BP反向传播一文弄懂神经网络中的反向传播法
- 使用watch监听路由变化和watch监听对象
- java web 连接数据库举例
- Android APP 市场地址
- 笨办法06字符串(string)和文本
- Linux 内核中的并发--概念
- DelayedOperationPurgatory分析
- 设计模式六大原则(5):开放封闭原则(OCP)
- MVC 数据验证
- 使用pm2部署node koa2项目并实现自动重启