How to use mapState function in typescript syntax when using vuex?

前端 未结 2 945
温柔的废话
温柔的废话 2021-02-19 05:59

I\'m using typescript syntax in my vuejs project that integrated with vuex. I want to use mapState method as computed in my .ts file but I got a syntax error. Currently I am usi

2条回答
  •  再見小時候
    2021-02-19 06:33

    Easier using JS Spread syntax:

    
    
    
    

    Your store:

    import Vue from 'vue';
    import Vuex from 'vuex';
    
    Vue.use(Vuex);
    
    export default new Vuex.Store({
      state: {
        stuff: 'some title',
      },
      mutations: {
    
      },
      actions: {
    
      },
    });
    

提交回复
热议问题