正在學習Vuex,今天對照了文檔中的實例寫了一下,發現無法完成文檔中的功能,并報錯[vuex] unknown action type: INCREMENT示例代碼如下:import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
count: 0
},
mutations: {
INCREMENT (state) {
// 改變 state
state.count++
}
}
})
store.dispatch('INCREMENT');
console.log(store.state.count)google了一下沒有發現這方面的信息,所以想請問一下,有沒有人遇到過這樣的情況,以及解決辦法是怎樣的
- 2 回答
- 0 關注
- 5561 瀏覽
添加回答
舉報
0/150
提交
取消