定义全局变量 const app = createApp({}) app.config.globalProperties.$http = () => {} 全局变量使用 const { proxy } = getCurrentInstance() 全局变量为null 如果按照上述情况还是获取不到,检测是否写在自定义函数中,尝试写在setup函数中 setup(){ const { proxy } = getCurrentInstance() }