vuex store doesn't update component

后端 未结 4 1437
别跟我提以往
别跟我提以往 2020-12-25 14:41

I\'m new to vue, so I\'m probably making a rookie error.

I have a root vue element - raptor.js:

const Component = {
el: \'#app\',
store,
data: {
             


        
4条回答
  •  温柔的废话
    2020-12-25 15:13

    You are calling the store into the productList data property in the wrong way.

    You can try it:

    data: {
      productList: $store.state.productlist
    }
    

    Otherwise you have to import store in each component that are using the store.

提交回复
热议问题