fjc0k / vue-better-sync

[Deprecated] Simply sync values. Moved to https://github.com/fjc0k/vue-messenger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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>

About

[Deprecated] Simply sync values. Moved to https://github.com/fjc0k/vue-messenger

License:MIT License


Languages

Language:JavaScript 85.5%Language:Vue 14.5%