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

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) => { const queryList = async (pageNo, pageSize) => {
// console.log(pageNo, pageSize) try{
const { const { lists } = await getArticleList({
lists
} = await getArticleList({
cid: props.cid, cid: props.cid,
pageNo, pageNo, pageSize
pageSize
}) })
console.log(lists)
paging.value.complete(lists); paging.value.complete(lists);
}catch(e){
console.log('报错=>',e)
//TODO handle the exception
paging.value.complete(false);
}
} }
</script> </script>

View File

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