Skip to content

hbackman/vuex-v-model

Repository files navigation

vuex-v-model

Version License Build Status Donate Ko-Fi GitHub stars

vuex-v-model is a library that enables two-way data binding using the Vue v-model directive.

Install

npm install vuex-v-model

Usage

The most basic usage is as simple as providing the fields you want to v-model through mapModels. This function accepts the same function parameters as mapState.

<template>
  <div>
    <input v-model="f_name" placeholder="First Name"/>
    <input v-model="l_name" placeholder="Last Name"/>
  </div>
</template>

<script>
  import { mapModels } from 'vuex-map-models';
  
  export default {
    computed: {
      ...mapModels([
        'f_name',
        'l_name',
      ]),
    },
  };

Author

Hampus Backman hampus@hbackman.com

License

MIT

About

Enable v-model for Vuex state

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages