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

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

View File

@ -97,13 +97,17 @@
} }
const queryList = async (pageNo, pageSize) => { const queryList = async (pageNo, pageSize) => {
const { lists } = await getSearch({ try{
keyword: keyword.value, const { lists } = await getSearch({
pageNo, pageSize keyword: keyword.value,
}) 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()