【小程序】-- 请求异常处理

This commit is contained in:
linjinyuan 2022-09-09 10:47:19 +08:00
parent 5db6380252
commit 5b33f47641
2 changed files with 22 additions and 17 deletions

View File

@ -24,16 +24,17 @@
}])
const queryList = async (pageNo, pageSize) => {
// console.log(pageNo, pageSize)
const {
lists
} = await getArticleList({
cid: props.cid,
pageNo,
pageSize
})
console.log(lists)
paging.value.complete(lists);
try{
const { lists } = await getArticleList({
cid: props.cid,
pageNo, pageSize
})
paging.value.complete(lists);
}catch(e){
console.log('报错=>',e)
//TODO handle the exception
paging.value.complete(false);
}
}
</script>

View File

@ -97,13 +97,17 @@
}
const queryList = async (pageNo, pageSize) => {
const { lists } = await getSearch({
keyword: keyword.value,
pageNo, pageSize
})
search.result = lists
paging.value.complete(lists);
try{
const { lists } = await getSearch({
keyword: keyword.value,
pageNo, pageSize
})
paging.value.complete(lists);
}catch(e){
console.log('报错=>',e)
//TODO handle the exception
paging.value.complete(false);
}
}
getHotSearchFunc()