/
index.js
44 lines (39 loc) 路 1.41 KB
/
index.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
( function () {
const Vue = require( '../../lib/vue/vue.js' );
const errorLogger = require( './errorLogger.js' );
const i18n = require( './i18n.js' );
const teleportTarget = require( 'mediawiki.page.ready' ).teleportTarget;
/**
* Additional functions and plugins added to the Vue object.
*
* For documentation on Vue's built-in functions, see
* {@link https://vuejs.org/api/ Vue's API reference}.
*
* @module vue
*/
/**
* Wrapper around {@link https://vuejs.org/api/application.html#createapp Vue.createApp} that
* adds the {@link module:vue#$i18n i18n plugin} and the error handler. These were added
* globally in Vue 2, but Vue 3 does not support global plugins.
*
* To ensure all Vue code has the i18n plugin and the error handler installed, use of
* `vue.createMwApp()` is recommended anywhere one would normally use `Vue.createApp()`.
*
* @method createMwApp
* @param {...any} args
* @return {Object} Vue app instance
* @memberof module:vue
*/
Vue.createMwApp = function ( ...args ) {
const app = Vue.createApp( ...args );
app.use( errorLogger );
app.use( i18n );
app.provide( 'CdxTeleportTarget', teleportTarget );
return app;
};
// HACK: the global build of Vue that we're using assumes that Vue is globally available
// in eval()ed code, because it expects var Vue = ...; to run in the global scope
// Satisfy that assumption
window.Vue = Vue;
module.exports = Vue;
}() );