一品网
  • 首页

vue 监听store中的数值


第一种使用 computed 和 watch 混合模式

computed: {
	isFollow() {
		return this.$store.state.userId
	}
},
watch: {
	isFollow(newVal, oldVal) {
		console.log(newVal)
	}
},

第二种使用 watch 模式

watch: {
	'$store.state.sys.oid'(newVal, oldVal) {
		if (newVal != oldVal) {
			console.log(11111111111)
		}
	}
}
vue

相关


创建vue项目的第一步——之安装vue 命令更新了

vue打包报错

vue登录页面后台返回验证码图片

Java web开发:从零到 Run 一个现有的 Spring Boot 前后端分离项目(前端Vue)

vue axios 1 创建项目及简单配置axios

vue两层list循环后,内层循环页面选择类型

HMVue1.5【Source Map】

vue代理服务器proxy详情配置信息

[转]Vue-cli3.x引入本地json报404 解决方案

[转]Vue CLI 3搭建vue+vuex 最全分析

AntDesign vue学习笔记(三)嵌套路由使用

vue 多项目部署---二级目录

标签

一品网 冀ICP备14022925号-6