vuejs2 - Vue-Multiselect 插件:如何安全地删除“添加新”标签功能?
问题描述
我正在使用一个名为Vue-Multiselect的插件,它在我的应用程序上运行良好。但是,插件中有一个我不想要的功能。我怎样才能安全地删除它?
让我解释一下:CodeSandBox 协作编辑器。 注意:要查看此流程的实际效果,请选择 ACME Widget 旁边的 EDIT,然后在多选输入框中搜索现有用户。
在多选输入框中搜索用户时,如果找到匹配项,则弹出匹配项供用户选择。那很好。但是,当未找到用户时,会有一个占位符文本显示以下内容:Press enter to create a tag
. 如果选项不存在,我不想让我的用户能够创建新的标签/选项。如何从此组件中删除该功能?
这是我的多选组件代码:
<multiselect
id="customer_last_name_input"
v-model="values"
:options="options"
label="lastname"
placeholder="Select or search for an existing customer"
track-by="uid"
:loading="isLoading"
:custom-label="customerSelectName"
aria-describedby="searchHelpBlock"
selectLabel
:multiple="true"
:taggable="true"
>
<template
slot="singleLabel"
slot-scope="props"
>{{ props.option.lastname }}, {{props.option.firstname}}</template>
<template slot="option" slot-scope="props">
<strong>{{ props.option.lastname }}</strong>
, {{ props.option.firstname }} —
<small>{{ props.option.email }}</small>
</template>
<!-- <template slot="noResult">Looks like this customer doesn't exist yet.<button class="btn btn-primary" type="button" @click="addCustomer">Add Customer</button></template> -->
</multiselect>
解决方案
我找到了答案。我只是taggle=true
从多选组件中删除了道具。
推荐阅读
- scala - java.lang.IllegalArgumentException:非法序列边界 Spark
- pandas - 熊猫系列与列表列表完全匹配
- javascript - Javascript二进制搜索算法无法在列表中找到数字
- python - 如何从 csv 文件创建模型实例
- python - Spyder 4.0.1 数据框预览
- .net - 我应该将哪个 .NET Azure 服务总线库用于队列?
- c++ - 检查是否以特定精度给出了双精度
- date - 如何在 SAS 宏循环计数器中用前导零填充数字?
- python - 如何构建python程序?试着让它更有条理,现在运行速度慢了 13 倍
- maven - 分析时无法加载组件类 org.sonar.scanner.scan.filesystem.ProjectFileIndexer