vuex基本使用( state, getters, mutations, actions, modules )
store/index.jsimport { createStore } from 'vuex'export default createStore({ // 这里的state就相当于组件中的data,就是专门用于保存共享数据的 state: { count: 0, todos: [], }, // 用于定义计算属性 getters: { doneTodos: (state) => { return state.todos.filter(todo => todo.
原创
2022-02-11 14:19:23 ·
611 阅读 ·
0 评论