Search code examples
vuetify.jsv-select

How to get append-outer-icon working in vuetify?


v-select allows to add append-outer-icon but how to force to expand icon list when this item is clicked?

 <v-select                
        :items="selectItems.position"
        v-model="selectedPosition"            

        clear-icon="highlight_remove"  
        append-icon="unfold_more"
        append-outer-icon="unfold_more"
        @click:append-outer="openSelect"                                                                  
        >

@click:append-outer allows add a callback function but what i have do in openSelect to expand the item's list?


Solution

  • You should add a ref to your v-select element. And then use this ref into your openSelect function:

    <template>
        <v-select
            ref="theSelect"
    
            :items="selectItems.position"
            v-model="selectedPosition"
    
            clear-icon="highlight_remove"
            append-icon="unfold_more"
            append-outer-icon="unfold_more"
            @click:append-outer="openSelect"
        />
    </template>
    
    <script>
        export default {
          methods: {
            openSelect () {
              this.$refs['theSelect'].onClick()
            }
          }
        }
    </script>