/** * see VueX docs */ export const state = () => ({ counter: 0, isFetching: false, searchInput: '', selectedResult: null, list: [], formConfig: { name: '', delivery: false, hours: ['a', 'b'], tags: [], }, }) export const mutations = { increment(state) { state.counter++ }, add(state, text) { state.list.push({ text, done: false, }) }, remove(state, { todo }) { state.list.splice(state.list.indexOf(todo), 1) }, setFormField(state, { field }) { state.formConfig[state.formConfig.indexOf(field)] = field }, setTag(state, { field }) { state.formConfig.tags[state.formConfig.tags.indexOf(field)] = field }, }