Vue-多选插件:如何安全地删除"添加新"标签功能?



我正在使用一个名为Vue-Multiselect的插件,并且它在我的应用程序上运行得很好。但是,插件中有一个我不想要的功能。如何安全地删除它?

让我解释一下: CodeSandBox 协作编辑器 .注意:要查看此流的运行情况,请选择 ACME 小组件旁边的编辑,然后在多选输入框中搜索现有用户。

在多选输入框中搜索用户时,如果找到匹配项,则会弹出匹配项供用户选择。很好。但是,当找不到用户时,有一个占位符文本,其中显示以下内容: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 }} &mdash;
<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道具。

最新更新