Questions tagged [vue-directives]

A Vue.js directive can only appear in the form of a prefixed HTML attribute that takes the following format:

<element
  prefix-directiveId="[argument:] expression [| filters...]">
</element>

Common directives are v-if , v-for, v-model...

218 questions
368
votes
5 answers

Difference between v-model and v-bind on Vue.js?

I'm learning Vue with an online course and the instructor gave me an exercise to make an input text with a default value. I completed it using v-model but, the instructor chose v-bind:value, and I don't understand why. Can someone give me a simple…
Gustavo Dias
  • 3,811
  • 3
  • 11
  • 6
241
votes
4 answers

Difference between @click and v-on:click Vuejs

The questions should be enough clear. But I can see that someone use: Someone use: But really what is the difference between the two (if exists)
LorenzoBerti
  • 6,704
  • 8
  • 47
  • 89
30
votes
3 answers

A custom directive similar to v-if in vuejs

I'm writing a custom directive in vue. I want it to work like v-if but it will have a little logic going inside it. Let me explain with an example: It will check the permission and will show or…
Yves
  • 3,752
  • 4
  • 29
  • 43
29
votes
2 answers