A
A
Alexey Sobolenko2019-07-17 01:02:32
Vue.js
Alexey Sobolenko, 2019-07-17 01:02:32

How to initiate a change in the value of a variable bound to a field through v-model?

I embed the markitup editor in the vue component, but when I insert any tags into the text, the value of the variable bound to the field through v-model does not change. The editor has the option to use the afterInsert method , which is what I did

afterInsert: function() {
        this.textarea.dispatchEvent(new Event("change"));
    },

but still the value of the variable does not change.
I checked about the same thing on the official Vue.js website - the situation is similar:
5d2e48ff9ec4f612783234.png
Maybe I'm calling the wrong event or do I need to process it somehow? Because on another page where there is no vue component of this, but the same editor setting is used, the save happens correctly.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ihor Bratukh, 2019-07-17
@BRAGA96

app6.message = 'HELLO';

M
Maxim Mzhelsky, 2019-09-29
@ort

It was necessary like this:
this.textarea.dispatchEvent(new Event("input"));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question