1.1.1 • Published 5 years ago

@shimochi/vuex-map-state-two-way v1.1.1

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

vuex-map-state-two-way

Installation

$ npm install @shimochi/vuex-map-state-two-way --save

Usage

<template>
  <form>
    <input v-model="name">
    <input v-model="email">
  </form>
</template>

<script>
import { mapStateTwoWay } from 'vuex-map-state-two-way';

export default {
  computed: {
    ...mapStateTwoWay('user', ['name', 'email'])
  }
}
</script>
export default {
  namespaced: true,
  state: {
    name: null,
    email: null
  },
  getters: {
    name: state => state.name,
    email: state => state.email
  },
  mutations: {
    name (state, name) {
      state.name = name
    },
    email (state, email) {
      state.email = email
    }
  },
  actions: {
    setName ({ commit }, value) {
      commit('name', value)
    },
    setEmail ({ commit }, value) {
      commit('email', value)
    }
  }
}

License

The vuex-map-state-two-way is open source software licensed under the MIT license.

1.1.1

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago