An open API service indexing awesome lists of open source software.

https://github.com/wangdahoo/map-state-vmodel

mapState for v-model
https://github.com/wangdahoo/map-state-vmodel

Last synced: 10 months ago
JSON representation

mapState for v-model

Awesome Lists containing this project

README

          

# map-state-vmodel
> mapState for v-model

### Install

```bash
$ npm i map-state-vmodel
```

### How to Use

* in *.vue

```vue



import {mapStateVModel} from 'map-state-vmodel'

export default {
computed: {
...mapStateVModel('user', [
'userName'
])
}
}

```

* 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.