35 lines
722 B
JavaScript
35 lines
722 B
JavaScript
export default {
|
|
template: `
|
|
<q-editor ref="qRef" v-model="inputValue">
|
|
<template v-for="(_, slot) in $slots" v-slot:[slot]="slotProps">
|
|
<slot :name="slot" v-bind="slotProps || {}" />
|
|
</template>
|
|
</q-editor>
|
|
`,
|
|
props: {
|
|
value: String,
|
|
},
|
|
data() {
|
|
return {
|
|
inputValue: this.value,
|
|
emitting: true,
|
|
};
|
|
},
|
|
watch: {
|
|
value(newValue) {
|
|
this.emitting = false;
|
|
this.inputValue = newValue;
|
|
this.$nextTick(() => (this.emitting = true));
|
|
},
|
|
inputValue(newValue) {
|
|
if (!this.emitting) return;
|
|
this.$emit("update:value", newValue);
|
|
},
|
|
},
|
|
methods: {
|
|
updateValue() {
|
|
this.inputValue = this.value;
|
|
},
|
|
},
|
|
};
|