【小程序】使用uni-app搭建小程序环境--VueX
使用VueX 存储登录状态
问题一:在vue页面中使用 this.$store.dispatch('login',option) 没有任何报错 没有任何反应
问题二:在js中使用 this.$tore.state.userInfo 报错 Uncaught TypeError: Cannot read property '$store' of undefined
解决方案:
import store from '../store'
const unserInfo = store.state.userInfo;
作者:smile.轉角
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
欢迎关注我,一起进步!扫描下方二维码即可加我QQ
浙公网安备 33010602011771号