在我的 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:
addref="tags"
to yourv-select
component
add@keyup.space="updateOnSpace('tags')"
to the component then
add themethod
:updateOnSpace(tags) { this.$refs[tags].onEnterDown(); },
至于粘贴带分隔符的文本值(search-input
会捕获值)并设置为选中数据,可以监听paste
事件,然后append split (通过任意定界符)值到选定值数组:
https://codepen.io/anon/pen/bKEQZY
关于javascript - 使用 , 而不是按 enter 验证带有筹码的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50679550/