Wednesday 25 March 2020

Vuex

https://vuex.vuejs.org/guide/getters.html
.
const store = new Vuex.Store({
  state: {
    todos: [
      { id: 1, text: '...', done: true },
      { id: 2, text: '...', done: false }
    ]
  },
  getters: {
    doneTodos: state => {
      return state.todos.filter(todo => todo.done)
    }
  }
})

No comments:

Post a Comment