为什么不能commit
<script>
import store from '@/store'
export default {
name: "Add",
store,
data() {
return {
title: '',
content: ''
}
},
methods: {
add() {
store.commit('addItem', {
title: this.title,
content: this.content
})
}
}
};
</script>export default new Vuex.Store({
state: {
lists: []
},
mutations: {
addItem(state,add) {
state.lists.push(add)
}
},