Javascript v-select在使用ajax时不显示选项+;可标记&x2B;倍数
这是用于搜索和选择用于抄送的电子邮件地址的输入。如果没有Javascript v-select在使用ajax时不显示选项+;可标记&x2B;倍数,javascript,vuejs2,v-select,Javascript,Vuejs2,V Select,这是用于搜索和选择用于抄送的电子邮件地址的输入。如果没有taggablev-select的AJAX搜索效果很好,但我需要能够“添加”电子邮件,这样我就可以选择“无论如何发送”。当我进行AJAX搜索时,taggable设置为true,它将显示上面的字符串,但不显示选项。我已经检查并验证了AJAX函数正在返回结果,所以它不可能是这样 我的代码是这样的: <v-select placeholder="" label="firstname"
taggable
v-select的AJAX搜索效果很好,但我需要能够“添加”电子邮件,这样我就可以选择“无论如何发送”。当我进行AJAX搜索时,taggable
设置为true
,它将显示上面的字符串,但不显示选项。我已经检查并验证了AJAX函数正在返回结果,所以它不可能是这样
我的代码是这样的:
<v-select placeholder=""
label="firstname"
v-model="edit_email_cc"
:taggable=true
:filterable=false
:multiple=true
:options="search_options"
@search:blur="handleEmailCCBlur()"
v-on:search="fetchSearchOptions">
<template #no-options="{ search }">
<span v-if="search == ''">Type to search...</span>
<span v-else>No person found for "{{search}}"</span>
</template>
<template #open-indicator="{ attributes }">
<span v-bind="attributes"></span>
</template>
<template #spinner="{ loading }">
<div v-if="loading" class="vs__spinner"></div>
</template>
<template slot="option" slot-scope="option">
<div class="v-select-options" v-if="option.lastname == undefined">
Send to email {{ option.firstname }}
</div>
<div class="v-select-options" v-else>
{{ option.firstname }} {{ option.lastname }} <strong>({{ option.email }})</strong>
</div>
</template>
<template slot="selected-option" slot-scope="option">
<div class="v-select-options selected">{{ option.firstname }} {{ option.lastname != undefined?option.lastname:'' }}</div>
</template>
</v-select>
任何帮助都将不胜感激!谢谢大家!
J
fetchSearchOptions(keyword, loading) {
this.search(loading, keyword, this, this.base_url);
},
search: debounce((loading, keyword, vm, base_url) => {
if (keyword === '') {
vm.search_options = [];
}
if (keyword !== '') {
var search_url = base_url + '/common/search';
loading(true);
axios.post(search_url, {keyword : escape(keyword), field : 'email'})
.then(response => {
vm.search_options = response.data;
console.log(vm.search_options);
loading(false);
})
}
}, 350),