A
A
Alexandra2021-04-20 10:05:26
Vue.js
Alexandra, 2021-04-20 10:05:26

How to modify data in a third party form created in vue via javascript?

Can you please tell me how you can change the data in the form if the site is written in vue?
There is a site that displays a form for questions. I want to fill out this form, but not by hand, but through javascript.
I do like this:

let domme = document.querySelectorAll('input')
domme[1].value = 'Hello world'

The data is substituted into the form, but the site itself does not see them, because when you click on TAB or click on another input with the mouse, this completed input is cleared.
I was told that this is because vue uses v-mode.
So I don’t understand how you can fill in the data on such a site through javascript?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Anikin, 2021-04-20
@randomizex

It is necessary to forward the input event.
Or change if the input has v-model.lazy

let domme = document.querySelectorAll('input')
domme[1].value = 'Hello world'
domme[1].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