123456789101112131415161718192021222324 |
- // import Dialog, { Toast, Alert } from '/@/components/basic/dialog'
- import Dialog, { Window, Toast, Alert, DialogContent } from '/@/components/basic/dialog';
- import Button from '/@/components/basic/button/index.vue';
- import type { App } from 'vue';
- function setup(...Components) {
- Components.forEach((Component) => {
- Component.install = function (app: App) {
- Component.use && Component.use(app);
- app.component(Component.name, Component);
- };
- });
- return Components;
- }
- // 注册带install与use hook
- const registerComponent = setup(Dialog, Window, Toast, Alert, DialogContent, Button);
- // console.log('registerComponent', registerComponent)
- export default {
- install: (app: App) => {
- registerComponent.forEach((component) => {
- component.install(app);
- });
- },
- };
|