feat: withInstall (#275)

This commit is contained in:
一万
2022-05-19 12:31:42 +08:00
committed by GitHub
parent b6ed8b40d1
commit 1f8e50f482
12 changed files with 34 additions and 81 deletions

9
src/utils/index.ts Normal file
View File

@@ -0,0 +1,9 @@
import type { App, Plugin } from "vue";
export const withInstall = <T>(component: T) => {
const comp = component as any;
comp.install = (app: App) => {
app.component(comp.name, component);
};
return component as T & Plugin;
};