0

How to update the Vue form field through the DOM?

I need to update field data through an external script. For this I need to know if it is possible to update the data through the DOM.

https://codesandbox.io/s/compassionate-feistel-26r4v?file=/src/store.js

I tried to do it directly through the Store, but in my case it doesn't work.

How to call the VueJs object via Chrome Extension?

Example

window.document.getElementsByClassName('el-input__inner')[0].value = 10

1 Answer 1

1

you can use ref for similar to querySelector reference in SFC.

in <template>:

<input type="text" ref="thisRef" name="textfield_1"/>

in <script> methods call:

this.$refs.thisRef[0].value = 10

Other than that, there's v-model for data binding.

hope helps

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.