Answer the question
In order to leave comments, you need to log in
How to bind div to data?
There are . I want to bind it to data.
If I do it reactively (remove v-once) I get cursor issues when printing - vue updates the div and puts the cursor at the beginning.
If I put v-once, then I can’t push data into div.<div contenteditable >
<div contenteditable v-once v-html="data" />
props: ['value'],
beforeMount() {
//Тут this.value еще undefined
this.$nextTick(function () {
this.data = this.value //Тут div уже отрендерен, v-once отработал, не обновляется
}.bind(this))
},
Answer the question
In order to leave comments, you need to log in
<div contenteditable ref="dataElem" />
props: ['value'],
mount() {
this.$nextTick(() => {
this.$refs.dataElem.innerHTML = this.value;
});
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question