-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.ts
31 lines (26 loc) · 943 Bytes
/
install.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { VueConstructor, DirectiveOptions, ComponentOptions } from "vue";
import * as _components from "@/components";
import * as _directives from "@/directives";
import OurVue from "vue";
export function install(Vue: VueConstructor, args: any = {}): void {
if (OurVue !== Vue) {
console.error(
`Multiple instances of Vue detected See https://github.com/vuetifyjs/vuetify/issues/4068 If you're seeing "$attrs is readonly", it's caused by this`
);
}
const directives = _directives as Record<string, DirectiveOptions>;
for (const key in directives) {
Vue.directive(key, directives[key]);
}
const components =
args.components || (_components as Record<string, ComponentOptions<Vue>>);
(function registerComponents(components) {
if (components) {
for (const key in components) {
Vue.component(key, components[key]);
}
return true;
}
return false;
})(components);
}