Simply sync values.
yarn add vue-better-syncCDN:
UNPKG
|
jsDelivr
(available as window.VueBetterSync)
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>