增加错误处理

This commit is contained in:
YeMingfei666 2025-01-09 17:57:26 +08:00
parent 9ac12b7627
commit df3bc23cfc
1 changed files with 13 additions and 3 deletions

View File

@ -30,9 +30,19 @@
title: ''
})
async function init() {
const res = await Api.getVideoDetail(options)
Object.assign(state, res)
state.list = res.list
try {
const res = await Api.getVideoDetail(options)
Object.assign(state, res)
state.list = res.list
} catch (error) {
// if(getCurrentPages().length>=2){
// uni.navigateBack()
// }else{
// uni.switchTab({
// url:'/pages/index/index'
// })
// }
}
}
function update({index,item}){
state.list[index]=item