import type { App, Plugin } from 'vue';
import { isFunction } from 'lodash-es';
import * as commonComponents from '/nerv-lib/component'; // 基础组件
import * as serviceComponents from './component'; // 业务基础组件
import * as serviceView from './view'; //业务组件

const components: Recordable<Plugin | any> = {
  ...commonComponents,
  ...serviceComponents,
  ...serviceView,
};

export function registerGlobalComponent(app: App) {
  Object.keys(components).forEach((key) => {
    const component = components[key];
    if (component.install || isFunction(component)) {
      app.use(component);
    }
  });
}
