aboutsummaryrefslogtreecommitdiffstats
path: root/resources/src/vue
diff options
context:
space:
mode:
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 c2616d8ad101..2ac24abe436f 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 (