设为首页
收藏本站
首页
Portal
技术区
BBS
Vue
JavaScript
Discuz!
导读
Guide
热点排行
1
TypeError: Cannot read properties of undefined (reading 'data') at O
2
安装Discuz! Q 环境要求与配置
代码人
»
技术区
›
技术广场
›
Vue
›
查看内容
返回列表
发新帖
TypeError: Cannot read properties of undefined (reading 'data') at Object.po
dmr
dmr
当前离线
积分
1753
418
主题
3
回帖
1753
积分
管理员
积分
1753
发消息
显示全部楼层
1.页面加载,接口POST请求,报错:
错误1:请求返回空响应
...index.ts:34 【src/config/axios/index.ts】
错误2:POST请求失败: TypeError: Cannot read properties of undefined (reading 'data') at Object.post
post: async <T = any>(option: any) => {
//const res = await request({ method: 'POST', ...option })
//return res.data as unknown as T
try {
const res = await request({ method: 'POST', ...option });
// 添加空值检查
if (!res) {
console.error('<font color="#ff0000">请求返回空响应</font>'); //<font color="#ff0000">错误1</font>
}
return res.data as unknown as T;
} catch (error) {
console.error('POST请求失败:', error);//<font color="#ff0000">错误2</font>
}
},
复制代码
错误1:Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'list')
at getList
上面的错误出处:
const getList = async () => {
loading.value = true
try {
// 工作台获取工作任务分页
const res = await workbenchApi.getWorkbenchList(queryParams.value)
list.value = res.list //错误1
total.value = res.total
// 获取工作任务统计
workbenchList.value = await workbenchApi.getWorkbenchCount()
if(workbenchList.value){
getDictObj('FLOW_BUS_OPT')
}
loading.value = false
} finally {
loading.value = false
}
}
3.上面的接口报错后,页面返回登录页面,进行登录,报错
Uncaught (in promise) Error: No match for
{"name":"Home","params":{}}
登录页面没有跳转,报错提示上面的错误。
怎么解决?
微信扫一扫,分享更方便
代码人
相关帖子
2026-7-22
220亿元超长期特别国债,支持老旧营运货车报废更新
2026-7-23
周星驰影迷集体维权,最终追回160余万元被盗款项
2026-7-23
日媒揭露731部队罪行
2026-7-23
2026,“导游行业已死”?
2026-7-23
美富豪换血求永生失败后克隆了自己
2026-7-23
年轻人为什么不爱康师傅了
2026-7-24
国务院批复同意!超7万亿元大产业,有这些新机遇→
2026-7-24
一男子虚构劳动关系骗领失业金获刑
2026-7-24
大叔跳江救的女娃今年考上北大了
2026-7-24
证监会原副主席方星海被查
上一篇:
vue3+ts项目开发笔记
下一篇: 没有了
发表于 2025-12-4 10:01:59
举报
回复
分享
dmr
dmr
当前离线
积分
1753
418
主题
3
回帖
1753
积分
管理员
积分
1753
发消息
楼主
|
显示全部楼层
解决办法:
有待测试,看看效果。
剩余
92%
内容需要支付
30.00
元 后可完整阅读
付费阅读
加入会员
支持付费阅读,激励作者创作更好的作品。会员可8折购买!
发表于 2025-12-4 10:45:22
举报
回复
返回列表
发新帖
本版积分规则
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
立即注册
黑夜模式
快速发帖
返回列表
返回顶部