Vue-select: How to push more items to options?

Created on 24 Apr 2020  路  2Comments  路  Source: sagalbot/vue-select

Hey guys, How I can push more items to the array options?

I'm trying to do something like this but it's not working:

<template>
<v-select v-model="selected" :options="options" append-to-body></v-select>
</template>

<script>
addMoreItems(items){
   items.map( item =>{
       this.options.push({
           label: item.node.email,
           value: item.node.email
        }})
   })
}
</script>

I'm adding these items once I got new items from a graphql request, also I see on the Vue devtools my new items but the component is not rendering

https://i.imgur.com/Ioo6WTI.png

Most helpful comment

Must be an issue in your application code. Here's a working example: https://codepen.io/sagalbot/pen/LYpWwWO?editors=1010

All 2 comments

Must be an issue in your application code. Here's a working example: https://codepen.io/sagalbot/pen/LYpWwWO?editors=1010

Thanks a bunch, @sagalbot, my issue was on the array push, now is fixed!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ducdev picture ducdev  路  3Comments

rudykaze picture rudykaze  路  3Comments

jluterek picture jluterek  路  3Comments

fabianmieller picture fabianmieller  路  3Comments

twz915 picture twz915  路  3Comments