【小程序】使用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;

 

 

 

相关资料:uni-app 使用Vuex+ (强制)登录

 

posted on 2020-04-17 20:39  smile轉角  阅读(1498)  评论(0)    收藏  举报

导航