aboutsummaryrefslogtreecommitdiffstats
path: root/resources/src/vue
diff options
context:
space:
mode:
authorRoan Kattouw <roan.kattouw@gmail.com>2021-11-05 12:07:52 -0700
committerRoan Kattouw <roan.kattouw@gmail.com>2021-11-05 13:17:44 -0700
commit14f9fb0249804ee267c59a52b05c6491ed7f05b8 (patch)
treee960138121cc4a025f6667d4627ea8a430ebba23 /resources/src/vue
parent43fa5b22984f167ae50ee43550b30610844830c4 (diff)
downloadmediawikicore-14f9fb0249804ee267c59a52b05c6491ed7f05b8.tar.gz
mediawikicore-14f9fb0249804ee267c59a52b05c6491ed7f05b8.zip
Vue: Add propsData parameter to Vue.createMwApp()
For compatibility with the createApp() API in Vue 3. Bug: T294476 Change-Id: I1fcdcf7bf87f5af2deb9763a231f2c360ea45b23
Diffstat (limited to 'resources/src/vue')
-rw-r--r--resources/src/vue/index.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/resources/src/vue/index.js b/resources/src/vue/index.js
index a0cae377ddce..bc440a33c23c 100644
--- a/resources/src/vue/index.js
+++ b/resources/src/vue/index.js
@@ -24,17 +24,25 @@
* To create and mount an app with Vuex:
* var RootComponent = require( './RootComponent.vue' ),
* store = require( './store.js' );
- * Vue.createMwApp( RootCompoinent )
+ * Vue.createMwApp( RootComponent )
* .use( store )
* .mount( '#foo' );
*
+ * To pass props to the component, pass them as the second parameter to createMwApp():
+ * Vue.createMwApp( RootComponent, { pageName: 'foo', disabled: false } );
+ *
* @param {Object} componentOptions Vue component options object
+ * @param {Object} [propsData] Props to pass to the component
* @return {Object} Object that pretends to be a Vue 3 app object, supports .use() and .mount()
*/
- Vue.createMwApp = function ( componentOptions ) {
+ Vue.createMwApp = function ( componentOptions, propsData ) {
var App = Vue.extend( componentOptions ),
finalOptions = {};
+ if ( propsData ) {
+ finalOptions.propsData = propsData;
+ }
+
// Wrap .use(), so we can redirect app.use( VuexStore )
App.use = function ( plugin ) {
if (