vue-better-sync

3.2.3 • Public • Published

vue-better-sync

Simply sync values.

Install

yarn add vue-better-sync

CDN: UNPKG | jsDelivr (available as window.VueBetterSync)

Usage

Inside your Vue components:

<template>
  <input
    v-model="localValue"
    @input="handleInput"
  />
</template>
<script>
  import VueBetterSync from 'vue-better-sync'
 
  export default {
    mixins: [
      VueBetterSync({
        prop: 'value', // v-model prop
        event: 'input' // v-model event
      })
    ],
 
    props: {
      value: String
    },
 
    methods: {
      handleInput(e) {
        this.syncValue(e.target.value) // sync value
      }
    }
  }
</script> 

Readme

Keywords

none

Package Sidebar

Install

npm i vue-better-sync

Weekly Downloads

4

Version

3.2.3

License

MIT

Unpacked Size

24.3 kB

Total Files

7

Last publish

Collaborators

  • funch