Home > Blockchain >  Bound function gets called multiple times over different components
Bound function gets called multiple times over different components

Time:01-07

I'm using vue-select for custom select inputs and bind a function on the selected property like:

<VueNextSelect  :selected="checkTimeout(inputData,...) ><VueNextSelect/>

I'm using the component including VueNextSelect multiple times in my form. When now selecting a value the function checkTimeout gets called as much as the number of select-inputs instead of just once. Even tho the component is in a different instance.

Could this be a problem of binding the function to selected? When using other inputs with e.g. @change.prevent the function gets just called once.

CodePudding user response:

The correct syntax for selected event is this.

<VueNextSelect  @selected="checkTimeout(inputData,...) />

https://iendeavor.github.io/vue-next-select/api-reference.html#selected

  •  Tags:  
  • Related