扫码关注官方订阅号
只能页面中展示的吗?我知道用this.$store.state可以获取这些state来操作
闭关修行中......
...mapState({ a: function (state) { return state.A }, b: function (state) { return state.b } })
在其他方法中直接访问this.a this.b即可
this.a this.b
直接用比如...mapState(['changePrePosition'])用的时候直接用this.changePrePosition()就行了
...mapState(['changePrePosition'])
this.changePrePosition()
...mapState(['value'])
使用this.value就可以取到值了,但是修改state的值需要经过mutations
this.value
mutations
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
在其他方法中直接访问
this.a this.b即可直接用比如
...mapState(['changePrePosition'])用的时候直接用this.changePrePosition()就行了使用
this.value就可以取到值了,但是修改state的值需要经过mutations