当前位置:网站首页>Use this for attributes in mapstate

Use this for attributes in mapstate

2022-06-21 09:15:00 Tie Hanhan plus

computed Use in mapState, To make properties available this, You need to use regular functions

     /** * mapState Objects form ( Alias ) +  Namespace is turned on (namespaced: true) *  You need to bring the module name to access the corresponding module state, For example, the following 'common' Module name  * **/
    ...mapState('common', {
    
      vuexCount: 'count',
      //  In order to be able to use  `this`  Get local state , You have to use regular functions 
      countPlusLocalState (state) {
    
        return state.count + this.temp
      }
    }),
原网站

版权声明
本文为[Tie Hanhan plus]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202221446081607.html

随机推荐