老师我这里用this.$request报错,我应该怎么修改呢?
来源:2-10 axios二次封装(下)

慕运维1161037
2022-02-18
login.vue:15 Uncaught (in promise) TypeError: this.$request is not a function
at Proxy.mounted (login.vue:15:10)
at callWithErrorHandling (runtime-core.esm-bundler.js:155:22)
at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:164:21)
at Array.hook.__weh.hook.__weh (runtime-core.esm-bundler.js:2667:29)
at flushPostFlushCbs (runtime-core.esm-bundler.js:356:32)
at flushJobs (runtime-core.esm-bundler.js:401:9)
写回答
2回答
-
河畔一角
2022-02-25
这是Vue3要先挂载到全局对象上,我们课程讲的是通过app.config.globalProperties来挂载的,使用的时候要用proxy.$request,你看下源码和视频
10 -
慕粉3946981
2022-03-01
import {getCurrentInstance} from 'vue' const globalProperties = getCurrentInstance().appContext.config.globalProperties globalProperties.$request
012022-03-01
相似问题