vuex-map | vue mutation map
![vuex-map](https://i.imgur.com/axBPWDg.jpg)
Enabletwo-waydatabindingforformfieldssavedinaVuexstore.Installnpm install --save vuex-map-fieldsBasicexampleThefollowingexamplecomponentshowsthemostbasicusage,formappingfieldstotheVuexstoreusingtwo-waydatabindingwithv-model,withoutdirectlymodifyingthestoreitself,butusinggetterandsetterfunctionsinternally(asitisdescribedintheofficialVuexdocumentation:Two-wayComputedProperty[1]).Storeimport Vue from vue;import Vuex from vuex; import { getField, updateField } from vuex-map-fields; Vue.use(Vuex)...
![vuex-map](http://pix4.agoda.net/hotelimages/agoda-homes/5899847/61e1a790eeb181e40e8f262ea5a396dc.jpg?s=800x)
Enable two-way data binding for form fields saved in a Vuex store.
Installnpm install --save vuex-map-fields
Basic exampleThe following example component shows the most basic usage, for mapping fields to the Vuex store using two-way data binding with v-model, without directly modifying the store itself, but using getter and setter functions internally (as it is described in the official Vuex documentation: Two-way Computed Property[1]).
Storeimport Vue from vue;
import Vuex from vuex;
import { getField, updateField } from vuex-map-fields;
Vue.use(Vuex);
export default new Vuex.Store({
state: {
fieldA: ,
fieldB: ,
},
getters: {
getField,
},
mutations: {
updateField,
},
});
Component<template>
<...
取得本站獨家住宿推薦 15%OFF 訂房優惠
本站住宿推薦 20%OFF 訂房優惠,親子優惠,住宿折扣,限時回饋,平日促銷
Mutations | vue mutation map
Actions | vue mutation map
Modules | vue mutation map
State | vue mutation map
Vuex mapMutations - How does it work? | vue mutation map
How can I mutate my module store state using map mutations from a ... | vue mutation map
Vuex Map Helpers | vue mutation map
vuex-map | vue mutation map
maoberlehnervuex-map-fields: Enable two | vue mutation map
[Vue.js] Vuex 學習筆記(7) | vue mutation map
Best practices for Vuex mapping | vue mutation map
Vuejs : mapMutations | vue mutation map
vuex (2) | vue mutation map
![](https://i.imgur.com/axBPWDg.jpg)