【小程序】使用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+ (強制)登錄

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM