使用 , 而不是按 enter 验证带有筹码的标签

vuetify tags with chips using , instead of hitting enter

在我的 vuetify 项目中,我有这样的东西

 <v-select
    v-model="data.emails"
    label="Add multiple recipent by hitting enter"
    multiple
    tags
    chips
    solo

></v-select>

这很好用。但它只有在我按下回车键时才有效。我想使用 , 来实现它,因为我将粘贴许多项目,例如电子邮件。这就是为什么我想骑回车。

有没有什么方法可以粘贴许多逗号分隔的电子邮件并获得数组中选中的筹码?

谢谢。

显然计划在 v1.1 中支持类似行为:
https://github.com/vuetifyjs/vuetify/issues/3287

我将从其中一条评论中复制临时解决方案。
@jakarn 写道:

for example:
add ref="tags" to your v-select component
add @keyup.space="updateOnSpace('tags')" to the component then
add the method: updateOnSpace(tags) { this.$refs[tags].onEnterDown(); },


至于粘贴带有分隔符的文本值(search-input将捕获值)并将其设置为选定数据,您可以监听paste事件然后附加拆分(通过任意分隔符)值到选定值数组:
https://codepen.io/anon/pen/bKEQZY