import { isFunction } from '@vue/shared'
import { App } from 'vue'
import UEmpty from '@/uni_modules/vk-uview-ui/components/u-empty/u-empty.vue'
import UModal from '@/uni_modules/vk-uview-ui/components/u-modal/u-modal.vue'
const modules = import.meta.glob('./modules/**/*.ts', { eager: true })

export default {
    install: (app: App) => {
        // Android 端部分页面在 easycom 解析上不稳定，先对高频基础组件做全局兜底注册。
        app.component('u-empty', UEmpty)
        app.component('u-modal', UModal)

        for (const module of Object.values(modules)) {
            const fun = module.default
            isFunction(fun) && fun(app)
        }
    }
}
