[Vuejs]-Vue v-on:click change it to load or mouse over event

0๐Ÿ‘

@mouseover and @mouseleave will do the job.

<input v-bind:value="2" @mouseover="reservationBy"/>

or

<input v-bind:value="2" @mouseleave="reservationBy"/>

0๐Ÿ‘

If using v-model is not an option (that would be the easiest way), and you want to execute the function when component is rendered, you can use ref and access value in mounted hook:

<input ref="myInputRef" :value="2" />

Script:

mounted: function() {
  console.log(this.$refs.myInputRef.value);
}

Leave a comment