提交 0afbfaa9 编写于 作者: zhujiamin's avatar zhujiamin

debug搜索历史组件 清除功能完善 --fix1

上级 36e6dfa6
......@@ -190,30 +190,32 @@ export default class AppRoundList extends Vue{
* @memberof AppSearchHistory
*/
public searchVal($event:any){
let val:any = $event.target.value;
val = val.trim();
if (val === "") {
return;
}
if (this.historyList.length > 0) {
if (this.historyList.indexOf(val) !== -1) {
this.historyList.splice(this.historyList.indexOf(val), 1);
this.historyList.unshift(val);
if ($event.target) {
let val:any = $event.target.value;
val = val.trim();
if (val === "") {
return;
}
if (this.historyList.length > 0) {
if (this.historyList.indexOf(val) !== -1) {
this.historyList.splice(this.historyList.indexOf(val), 1);
this.historyList.unshift(val);
} else {
this.historyList.unshift(val);
}
} else {
this.historyList.unshift(val);
}
} else {
this.historyList.unshift(val);
}
if (this.historyList.length > 10) {
this.historyList.pop();
}
if (this.enableHistory) {
this.historyLists = this.historyStorage.find((historyLists:any)=>{
return historyLists.viewname == this.model.viewname;
})
this.historyLists.historyList = this.historyList;
localStorage.setItem('historyStorage', JSON.stringify(this.historyStorage))
if (this.historyList.length > 10) {
this.historyList.pop();
}
if (this.enableHistory) {
this.historyLists = this.historyStorage.find((historyLists:any)=>{
return historyLists.viewname == this.model.viewname;
})
this.historyLists.historyList = this.historyList;
localStorage.setItem('historyStorage', JSON.stringify(this.historyStorage))
}
}
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册