[vuex] unknown mutation type: count
时间: 2023-12-27 13:02:51 浏览: 211
This error message is related to Vuex, which is a state management library for Vue.js.
It means that you are trying to commit a mutation that does not exist in your store. In this case, you are trying to commit a mutation called "count", but it is not defined in your store.
To fix this error, you should check your store's mutations and make sure that "count" is defined. You can define it like this:
```
mutations: {
count(state, payload) {
state.count += payload;
}
}
```
Make sure that you are also calling the mutation correctly in your component. For example, if you want to add 1 to the count, you can do it like this:
```
this.$store.commit('count', 1);
```
This will call the "count" mutation and pass in a payload of 1. The mutation will update the state by adding 1 to the current count.
阅读全文