We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a458999 commit 06121a6Copy full SHA for 06121a6
src/install.ts
@@ -1,17 +1,17 @@
1
-import type { Plugin } from 'vue'
2
import { useGlobalConfig } from 'vue-global-config'
+import type { Plugin, install } from 'vue-demi'
3
import Component from './Component'
4
import type { Mode } from './Component'
5
6
-type SFCWithInstall<T> = T & Plugin
+type SFCWithInstall<T> = T & Plugin & { install: typeof install }
7
8
const withInstall = <T, E extends Record<string, any>>(
9
main: T,
10
extra?: E,
11
) => {
12
(main as SFCWithInstall<T>).install = (app): void => {
13
for (const comp of [main, ...Object.values(extra ?? {})]) {
14
- app.component(comp.name, comp)
+ app?.component(comp.name, comp)
15
}
16
17
0 commit comments