vue之组件内监控$store中定义变量的变化详解
作者:至尊宝z紫霞 时间:2023-07-02 17:01:31
// 1.采用计算属性来获取$store中的值
computed: {
listenstage() {
return this.$store.state.iShaveMsg;
}
},
// 2.通过watch来检查定义计算属性获取到的值的变化
watch:{
listenstage: function(ov,nv){
console.log('watch start……');
if(this.$store.state.iShaveMsg){
//业务处理
}
}
console.log('watch stop……');
}
},
来源:https://blog.csdn.net/qq_21804983/article/details/80081370
标签:vue,监控,$store,定义变量
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python3 简单实现组合设计模式
2023-06-12 19:15:50
![](https://img.aspxhome.com/file/2023/2/59482_0s.png)
Pycharm+django2.2+python3.6+MySQL实现简单的考试报名系统
2024-01-26 14:46:02
![](https://img.aspxhome.com/file/2023/8/133558_0s.png)
php文件类型MIME对照表(比较全)
2023-06-08 07:24:10
pyqt5 从本地选择图片 并显示在label上的实例
2022-12-12 17:48:04
![](https://img.aspxhome.com/file/2023/1/94001_0s.jpg)
Oracle数据库及应用程序优化开发者网络Oracle
2010-07-18 13:02:00
高质量Python代码编写的5个优化技巧
2022-04-20 16:49:16
Python编程之event对象的用法实例分析
2023-02-19 09:29:50
python中sqllite插入numpy数组到数据库的实现方法
2024-01-16 20:31:29
MySQL的使用中实现读写分离的教程
2024-01-20 00:03:23
php实现压缩多个CSS与JS文件的方法
2023-11-23 08:39:59
Python利用Redis计算经纬度距离案例
2021-03-05 04:51:35
菜单效果
2020-08-16 04:45:01
利用tcpdump对mysql进行抓包操作技巧
2024-01-23 04:52:50
python中virtualenvwrapper安装与使用
2022-07-28 03:21:52
Python数据可视化绘图实例详解
2022-06-11 15:51:27
![](https://img.aspxhome.com/file/2023/2/134522_0s.png)
python实现稀疏矩阵示例代码
2023-10-03 02:37:18
![](https://img.aspxhome.com/file/2023/9/126889_0s.png)
Gradio机器学习模型快速部署工具quickstart
2023-06-30 01:09:52
![](https://img.aspxhome.com/file/2023/5/62545_0s.png)
原生js实现对Ajax的封装(仿jquery)
2024-04-22 12:57:06
使用Python进行中文繁简转换的实现代码
2021-05-04 09:19:03
利用numba让python速度提升百倍
2022-06-12 14:31:02
![](https://img.aspxhome.com/file/2023/9/77879_0s.png)