Explorar el Código

feat: add `useComponent` hook

xiaoxian521 hace 3 años
padre
commit
506bfc8087
Se han modificado 2 ficheros con 5 adiciones y 1 borrados
  1. 1 1
      build/plugins.ts
  2. 4 0
      src/utils/useComponent.ts

+ 1 - 1
build/plugins.ts

@@ -54,7 +54,7 @@ export function getPluginsList(command, VITE_LEGACY) {
           import { setupProdMockServer } from './mockProdServer';
           setupProdMockServer();
         `,
-      logger: true
+      logger: false
     }),
     // 是否为打包后的文件提供传统浏览器兼容性支持
     VITE_LEGACY

+ 4 - 0
src/utils/useComponent.ts

@@ -0,0 +1,4 @@
+import { h, resolveComponent } from "vue";
+
+export const dynamicComponent = (component: string) =>
+  h(resolveComponent(component));