vue-vben-admin/src/components/registerGlobComp.ts

17 lines
451 B
TypeScript
Raw Normal View History

2020-09-28 20:19:10 +08:00
import Icon from './Icon/index';
import Button from './Button/index.vue';
import { Button as AntButton } from 'ant-design-vue';
import { getApp } from '/@/useApp';
2020-09-28 20:19:10 +08:00
const compList = [Icon, Button, AntButton.Group];
// Fix hmr multiple registered components
let registered = false;
export function registerGlobComp() {
if (registered) return;
2020-09-28 20:19:10 +08:00
compList.forEach((comp: any) => {
getApp().component(comp.name, comp);
2020-09-28 20:19:10 +08:00
});
registered = true;
2020-09-28 20:19:10 +08:00
}