结合await,// 模拟API请求 const fetchData = async (page, size) => { let obj = { data: [], total: 0 } try { baseApi.getAlgorithm({ algorithmProcessId: "WorkRecordCreateList", param: { data: { token: uni.getStorageSync('token') } } }).then(res => { if (res && res.success) { console.log('返回数据:', res) obj.data = res.data.list obj.total = res.data.list.length } else { uni.showToast({ icon: 'none', title: '请求失败!' }) } }) return obj } catch (error) { uni.showToast({ icon: 'none', title: '请求失败!' }) console.log('请求失败', error) return obj }}如何让数据返回后再执行打印
发送后 ai 不回复死掉了
|