【发布时间】:2021-10-07 14:15:39
【问题描述】:
我在 Vuetify 中有以下组合框:
<v-combobox v-model="supplier.supplier_type" maxlength="255" :items="company.supplier_types" item-text="name" item-value="id" :label="$t('supplier.supplier_types')" :hide-no-data="true" outlined :error-messages="errors" :return-object="false">
</v-combobox>
然而,虽然 item-text 在 item slot 中正确显示,但它在 selection slot 中显示了 id:
我是否应该更改组合框上的任何内容?
我尝试使用插槽指定项目文本,但没有成功:
<v-combobox v-model="supplier.supplier_type" maxlength="255" :items="company.supplier_types" item-text="name" item-value="id" :label="$t('supplier.supplier_types')" :hide-no-data="true" outlined :error-messages="errors" :return-object="false">
<template v-slot:selection="{ item, index }">
{{item.name}}
</template>
<template v-slot:item="{ on, item }">
<v-list-item v-on="on">
{{item.name}}
</v-list-item>
</template>
</v-combobox>
【问题讨论】:
标签: combobox vuetify.js