UNPKG

1.87 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.install = install;
7
8var _vue = _interopRequireDefault(require("vue"));
9
10var _console = require("./util/console");
11
12function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14function install(Vue) {
15 var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16 if (install.installed) return;
17 install.installed = true;
18
19 if (_vue.default !== Vue) {
20 (0, _console.consoleError)('Multiple instances of Vue detected\nSee https://github.com/vuetifyjs/vuetify/issues/4068\n\nIf you\'re seeing "$attrs is readonly", it\'s caused by this');
21 }
22
23 var components = args.components || {};
24 var directives = args.directives || {};
25
26 for (var name in directives) {
27 var directive = directives[name];
28 Vue.directive(name, directive);
29 }
30
31 (function registerComponents(components) {
32 if (components) {
33 for (var key in components) {
34 var component = components[key];
35
36 if (component && !registerComponents(component.$_vuetify_subcomponents)) {
37 Vue.component(key, component);
38 }
39 }
40
41 return true;
42 }
43
44 return false;
45 })(components); // Used to avoid multiple mixins being setup
46 // when in dev mode and hot module reload
47 // https://github.com/vuejs/vue/issues/5089#issuecomment-284260111
48
49
50 if (Vue.$_vuetify_installed) return;
51 Vue.$_vuetify_installed = true;
52 Vue.mixin({
53 beforeCreate: function beforeCreate() {
54 var options = this.$options;
55
56 if (options.vuetify) {
57 options.vuetify.init(this, options.ssrContext);
58 this.$vuetify = Vue.observable(options.vuetify.framework);
59 } else {
60 this.$vuetify = options.parent && options.parent.$vuetify || this;
61 }
62 }
63 });
64}
65//# sourceMappingURL=install.js.map
\No newline at end of file