Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

fjc0k/vue-better-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>

Releases

No releases published

Packages

No packages published