Vuex

const state = {
  notebooks:  []
}
const getters = {
  notebooks: state=>state.notebooks
}
const mutations = {
  setNotebooks(state,{notebooks}){
    state.notebooks = notebooks
  },
  addNotebook(state,{notebook}){
    state.notebooks.unshift(notebook)
  },
  deleteNotebook(state,{notebookId}){
    state
  }
}
const actions = {

}

export default {
  state,
  getters,
  mutations,
  actions
}

你可能感兴趣的:(Vuex)