index.ts 542 B

123456789101112131415161718192021
  1. import type { App } from 'vue';
  2. import { components } from './components';
  3. export * from './components';
  4. export type ComponentType = keyof typeof components;
  5. export const install = function (app: App) {
  6. Object.keys(components).forEach(key => {
  7. const component = components[key as keyof typeof components] as { install?: (app: App<any>) => any };
  8. if (component?.install) {
  9. console.log('注册组件:', key);
  10. app.use(component as any);
  11. }
  12. });
  13. return app;
  14. };
  15. export default {
  16. version: '1.0.0',
  17. install,
  18. };