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

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

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