remoteMethod(query) { if (this.timer) { clearTimeout(this.timer); } if (query !== "") { this.loading = true; this.timer = setTimeout(() => { this.loading = false; this.options = this.list.filter((item) => { return item.label.toLowerCase().indexOf(query.toLowerCase()) > -1; }); }, 1000); } else { this.options = []; } },
remoteMethod //远程搜索方法,输入值改变后触发
添加定时器后指的是用户停止输入一秒后执行代码