javascript - Block an onChange event on a select when options are created by a v-for -


<select v-on:change="webservicecall()">  <option v-for:="option in options">  </option>  </select>

actually on-change triggered when options created in v-for , dont want happen, there semantic option or should use kind of vuejsisready function in javascript ?

you can use watcher monitor when selectedvalue changed instead.

in html:

<select v-model="selectedoption">     <option disabled value="">please select one</option>     <option v-for="type in types" v-bind:value="type.value">     {{type.value}}</option> </select> 

then in javascript:

data: {     selectedoption: '', }, watch: {     selectedoption(newval) {         // assuming available options not ''         if (newval !== '') {             // user has chosen item             this.webservicecall()         }      } } 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -