q42-cms-components
Version:
Front-end package that provides a UI on top of the QMS back-end
16 lines (15 loc) • 385 B
JavaScript
export const ValueSyncMixin = {
data() {
return {
valueCopy: this.value, // used to be able to update prop 'value' in the parent
}
},
watch: {
value() {
this.valueCopy = this.value; // create two-way binding
},
valueCopy(newValue) {
this.$emit('input', newValue); // vue syntax: update prop 'value' in the parent
}
},
}