7.3 节 使用 getCurrentInstance 获取 ctx问题
来源:3-11 【资料梳理】接口文档---用户管理

快乐源泉
2021-08-23
老师您好:
const { ctx } = getCurrentInstance()
const { list, page } = await ctx.$api.getUserList()
ctx 获取不到globalProperties定义的 $api
const internalInstance = getCurrentInstance()
const { list, page } = await internalInstance.appContext.config.globalProperties.$api.getUserList()
写回答
1回答
-
ctx换成proxy试一下
132023-04-27
相似问题