bug fixed in dropDown
This commit is contained in:
parent
6365a06cbb
commit
3bb1eef43d
|
@ -34,7 +34,9 @@ export default class DropDown {
|
|||
this.search = '';
|
||||
this.showLoadMore = this.loadMore != null;
|
||||
if (this.filterAction) {
|
||||
this.filterAction();
|
||||
this.filterAction({search: this.search});
|
||||
} else {
|
||||
this.filterItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ export default class IconMenu {
|
|||
this.$http = $http;
|
||||
this.$timeout = $timeout;
|
||||
this._showDropDown = false;
|
||||
this.finding = false;
|
||||
}
|
||||
get showDropDown() {
|
||||
return this._showDropDown;
|
||||
|
@ -18,16 +19,20 @@ export default class IconMenu {
|
|||
if (!this.url)
|
||||
return this.items ? this.items : [];
|
||||
|
||||
if (search) {
|
||||
if (search && !this.finding) {
|
||||
let filter = {where: {name: {regexp: search}}};
|
||||
let json = JSON.stringify(filter);
|
||||
|
||||
this.finding = true;
|
||||
this.$http.get(`${this.url}?filter=${json}`).then(
|
||||
json => {
|
||||
this.items = json.data;
|
||||
this.finding = false;
|
||||
},
|
||||
() => {
|
||||
this.finding = false;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
} else if (!search && !this.finding) {
|
||||
this.items = [];
|
||||
this.getItems();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue