有没有办法在 v-select 的项目文本字段中将两个字段连接在一起?
我让它为下拉列表值工作,但可见条目不显示这两个字段。
问题在这里:item-text=“’\({data.item.name}, \){data.item.group}‘”
代码:
`<v-select label="Select" v-bind:items="people" v-model="e11"
item-text="'${data.item.name}, ${data.item.group}'"
item-value="name" max-height="auto" autocomplete >
<template slot="item" slot-scope="data">
<v-list-tile-content>
<v-list-tile-title
v-html="`${data.item.name}, ${data.item.group}`">
</v-list-tile-title>
<v-list-tile-sub-title
v-html="data.item.group">
</v-list-tile-sub-title>
</v-list-tile-content>
</template>
</v-select>`
笔示例: https ://codepen.io/anon/pen/dJveWM?editors=1010
谢谢
原文由 DCripps 发布,翻译遵循 CC BY-SA 4.0 许可协议
您不仅需要为插槽
item
定义模板,还需要为插槽selection
在使用<v-select>
--- 时定义模板:看
以供参考。
这也可以是一个更简单的解决方案,就像您要实现的解决方案一样:
另请参阅实际操作:
https://codepen.io/anon/pen/PEpaMM?editors=1011