Vuex——使用namespace的store使用mapState获取state为undefined
生活随笔
收集整理的這篇文章主要介紹了
Vuex——使用namespace的store使用mapState获取state为undefined
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
問題描述
使用namespace的store使用mapState獲取state為undefined
解決方案
1....mapState中基于屬性的訪問
...mapState({searchInput: state => state.yourModuleName.searchInput,})2.在Vuex模塊中使用namespace
.......... modules: { yourModuleName: {namespaced: true, ........./* Using the namespace in mapState */ ...mapState('yourModuleName',['searchInput', ])OR?
computed: mapState('ModuleName',['state'])?
參考文章
Vuex map state undefined state
vuex 使用...mapState獲取到undefined
為什么$store.state里的數據通過mapState后是undefined?
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的Vuex——使用namespace的store使用mapState获取state为undefined的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Mybatis Plus——AutoGe
- 下一篇: Spring Security + We