0.3.0 • Published 6 years ago

map-state-vmodel v0.3.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

map-state-vmodel

mapState for v-model

Install

$ npm i map-state-vmodel

How to Use

  • in *.vue
<template>
  <div>
    <input v-model="userName" />
  </div>
</template>
<script>
import {mapStateVModel} from 'map-state-vmodel'

export default {
  computed: {
    ...mapStateVModel('user', [
      'userName'
    ])
  }
}
</script>
  • in store file user.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.

0.3.0

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago