Search code examples
vuexvuetify.jsv-select

v-select displays object Object


I'm new to vuetify and I'm stuck on how to properly use v-select. I'm pulling the select values from an API to a store called FormatTypes that looks like this:

[{"id":5,"formatlabel":"RDBMS Table or View"}
,{"id":6,"formatlabel":"Microsoft Access"}
....
,{"id":23,"formatlabel":"ArcGIS for Server image services"}]

my v-select:

<v-select font-weight-regular subtitle-1
          v-model=dataset.formattypeid
          :name="FormatTypes"
          :items="FormatTypes"
          :item-value="FormatTypes.id"
          :item-text="FormatTypes.formatlabel"
          :label="FormatTypeLbl"
          :outlined=true
           >

I've used the item-text/item-value props but I'm still getting the "object Object" in the display.


Solution

  • You don't have to use binding and no need to link it back with the items in item-value and item-text

    <v-select font-weight-regular subtitle-1
       v-model=dataset.formattypeid
       :name="FormatTypes"
       :items="FormatTypes"
       item-value="id" // No need of binding and no need of FormatTypes linking
       item-text="formatlabel" // No need of binding and no need of FormatTypes linking
       :label="FormatTypeLbl"
       :outlined=true
       >