提交 6884d7a3 编写于 作者: chengxiang.li's avatar chengxiang.li

debug

上级 82f9d15a
...@@ -114,6 +114,7 @@ ...@@ -114,6 +114,7 @@
noMore: false, noMore: false,
totalPageNum: 0, totalPageNum: 0,
isInputResponse: false, isInputResponse: false,
searchFlagTimer: null,
} }
}, },
computed: { computed: {
...@@ -178,6 +179,7 @@ ...@@ -178,6 +179,7 @@
}, },
handleSearchListBlur() { handleSearchListBlur() {
this.searchList = []; this.searchList = [];
clearTimeout(this.searchFlagTimer);
// console.log('blur.....') // console.log('blur.....')
}, },
handleSearchWrapScroll() { handleSearchWrapScroll() {
...@@ -204,6 +206,8 @@ ...@@ -204,6 +206,8 @@
}, },
// 搜索框中输入文字 时 page=1 pageSize=30 // 搜索框中输入文字 时 page=1 pageSize=30
handleInputSearch() { handleInputSearch() {
// debugger;
clearTimeout(this.searchFlagTimer);
let that = this; let that = this;
that.page = 1; that.page = 1;
that.isInputResponse = false; that.isInputResponse = false;
...@@ -217,40 +221,46 @@ ...@@ -217,40 +221,46 @@
page: 1, page: 1,
pageSize: 30, pageSize: 30,
}; };
goToSearch(params).then(res => { this.searchFlagTimer = setTimeout(() => {
console.log('>>>>>>*********** search: ', res) goToSearch(params).then(res => {
if(res.code == '000000'){ console.log('>>>>>>*********** search: ', res)
that.isInputResponse = true; if(res.code == '000000'){
that.totalPageNum = Math.ceil(res.data.total/that.pageSize); // 总页数 that.isInputResponse = true;
let list = res.data.icdContentsList || []; that.totalPageNum = Math.ceil(res.data.total/that.pageSize); // 总页数
if(list.length > 0){ let list = res.data.icdContentsList || [];
if(that.searchInput == ''){ if(list.length > 0){
if(that.searchInput == ''){
that.searchList = [];
return;
}
that.searchList = list;
that.hasNoResult = false;
}else{
that.searchList = []; that.searchList = [];
return; that.hasNoResult = true;
} }
that.searchList = list;
that.hasNoResult = false;
}else{ }else{
that.isInputResponse = false;
that.searchList = []; that.searchList = [];
that.hasNoResult = true; that.$message({
message: data.message,
type: 'warning'
});
} }
}else{ })
that.isInputResponse = false; }, 300)
that.searchList = [];
that.$message({
message: data.message,
type: 'warning'
});
}
})
}, },
// 上拉加载更多 // 上拉加载更多
loadMore() { loadMore() {
// debugger;
console.log('loadmore...') console.log('loadmore...')
let that = this; let that = this;
if( !that.isInputResponse ){ if( !that.isInputResponse ){
return; return;
} }
if( !(that.searchList && that.searchList.length > 0) ){
return;
}
that.busy = true; that.busy = true;
that.page += 1; that.page += 1;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册