B
B
BonBon Slick2018-03-18 14:52:57
Vue.js
BonBon Slick, 2018-03-18 14:52:57

When to use ref and when to use v-model?

<input v-model="email"/>
//or
<input ref="email"/>

What and when to use? Why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2018-03-18
@BonBonSlick

ref - when you need to access the element from the code
v-model - when you need to associate data with the content of the element
These 2 concepts are NOT similar in any way

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question