You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
638 B

2 days ago
import { getCurrentInstance } from 'vue'
// 导入Uniapp生命周期函数
import { onLoad, onShow, onHide, onPageScroll } from '@dcloudio/uni-app'
// 导出生命周期函数(直接转发,保持原功能)
export { onLoad, onShow, onHide, onPageScroll }
// 导出全局属性访问工具(复用之前的逻辑)
export const useGlobal = () => {
const instance = getCurrentInstance()
if (!instance) {
throw new Error('useGlobal 必须在组件 setup 或生命周期中调用')
}
return {
$http: instance.appContext.config.globalProperties.$http,
$util: instance.appContext.config.globalProperties.$util
}
}