全局变量挂载 vue2 Vue.prototype.$api = api; vue3 const app = Vue.createApp({}) app.config.globalProperties.$api = api;