v-select 显示对象 Object [英] v-select displays object Object

查看:94
本文介绍了v-select 显示对象 Object的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 vuetify 的新手,我一直在思考如何正确使用 v-select.我将选择值从 API 提取到名为 FormatTypes 的存储中,如下所示:

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"}]

我的 v-select:

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
           >

我已经使用了 item-text/item-value 道具,但我仍然在显示中看到object Object".

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

推荐答案

您不必使用绑定,也无需将其与 item-value 中的项目链接回项目文本

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
   >

这篇关于v-select 显示对象 Object的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆