mapState for v-model
npm install map-state-vmodel``bash`
$ npm i map-state-vmodel
in .vue
`vue`
* in store file user.js
`js
import {createSetters} from 'map-state-vmodel'
const state = {
userName: 'wangdahoo'
}
const mutations = {
...createSetters(state)
}
const getters = {}
const actions = {}
export default {
namespaced: true,
state,
mutations,
getters,
actions
}
``
That's it.