0

I need to create several <multiselects>. In doing this I must identify the clicked list in some way with the purpose of passing this name to the method that makes push into the list.

By example, given these lists:

 List A               |    List B         |    List C          |
 --------------------------------------------------------------|
 {tag:xz   , code:1}  |{tag:pkrte,code:1} |{tag:Item1,code:1 } |
 {tag:ac   , code:2}, |{tag:bnetf,code:2},|{tag:Item2,code:2 },|
 {tag:bz   , code:3}, |{tag:erert,code:3},|{tag:Item3,code:3 },|
 {tag:hy   , code:4}, |{tag:kjerx,code:4},|                    |
 {tag:yjer , code:5}, |                   |                    |

I have defined this multiselects:

(simplified code to exemplify)

<multiselect             |<multiselect             |<multiselect                  
  v-model="SelAlergies1" |  v-model="SelAlergies2" |  v-model="SelAlergies3"
  :height="300"          |  :height="300"          |  :height="300"               
  :options="ListA"       |  :options="ListB"       |  :options="ListC"
  :multiple="true"       |  :multiple="true"       |  :multiple="true"
  :taggable="true"       |  :taggable="true"       |  :taggable="true"
  placeholder="Alergies1"|  placeholder="Alergies2"|  placeholder="Alergies3"
  @tag="addTag('ListA')" |  @tag="addTag('ListB')" |  @tag="addTag('ListC')" 
  label="Tag"            |  label="Tag"            |  label="Tag"
  track-by="Code" >      |  track-by="Code">       |  track-by="Code" >          
</multiselect>           |</multiselect>           |</multiselect>   

I'm trying to send the list as a parameter in the event

@tag="addTag('ListA')"

How can I pass as a parameter the name of the list (ListA, ListB. ListC )to indicate to the method which list should push?

addTag(newTag, listName ) {
 const tag = {
   Etiqueta: newTag,                
 };
 this.listName.push(tag);
 this.listName.push(tag);`
},

How can I achieve this?

4
  • What problem are you facing? Commented Dec 26, 2022 at 16:13
  • I need get dynamically the name of the list where it was clicked, to push the new elemnt Commented Dec 26, 2022 at 17:35
  • Isn't your clicked element saving into the SelAlergiasMedicamentos, your v-model variable? Commented Dec 27, 2022 at 4:11
  • @NehaSoni , i have edited to exemplify. Commented Dec 27, 2022 at 13:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.