问题描述
这是用于搜索和选择CC-ing电子邮件地址的输入。没有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>
fetchSearchOptions(keyword,loading) {
this.search(loading,keyword,this,this.base_url);
},search: debounce((loading,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),
任何帮助将不胜感激!谢谢!
J
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)