You've already forked lubo_comment_query
修复插件配置问题
This commit is contained in:
19
resources/js/vendor/picomplete/picomplete.js
vendored
19
resources/js/vendor/picomplete/picomplete.js
vendored
@ -96,7 +96,7 @@ export default class PickleComplate {
|
||||
this.sug_div = document.createElement('DIV');
|
||||
this.sug_div.classList.add('picomplete-items');
|
||||
for (let i = 0; i < this.container.length; i++) {
|
||||
if (this.container[i].text.toLowerCase().includes(el.value.toLowerCase()) || this.container[i].value.toLowerCase().includes(el.value.toLowerCase())) {
|
||||
if (this.containsSuggest(this.container[i], el.value)) {
|
||||
//create list item
|
||||
let item = document.createElement('DIV');
|
||||
//set class
|
||||
@ -117,6 +117,23 @@ export default class PickleComplate {
|
||||
if(this.sug_div !== null) this.element.parentNode.appendChild(this.sug_div);
|
||||
}
|
||||
|
||||
containsSuggest(item, value) {
|
||||
if (item.text.toLowerCase().includes(value.toLowerCase()) ||
|
||||
item.value.toLowerCase().includes(value.toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
if (this.config.suggest) {
|
||||
if (typeof this.config.suggest === "string") {
|
||||
this.config.suggest = [this.config.suggest]
|
||||
}
|
||||
for (const suggest_key of this.config.suggest) {
|
||||
if (item.hasOwnProperty(suggest_key) && item[suggest_key].toLowerCase().includes(value.toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user