single-spa-vue
Advanced tools
Comparing version 0.0.3 to 0.1.0
{ | ||
"name": "single-spa-vue", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"description": "a single-spa plugin for vue.js applications", | ||
@@ -5,0 +5,0 @@ "main": "lib/single-spa-vue.js", |
@@ -8,3 +8,3 @@ const defaultOpts = { | ||
export default function singleSpaReact(userOpts) { | ||
export default function singleSpaVue(userOpts) { | ||
if (typeof userOpts !== 'object') { | ||
@@ -27,2 +27,7 @@ throw new Error(`single-spa-vue requires a configuration object`); | ||
// use Vuex | ||
if (opts.Vuex) { | ||
opts.Vue.use(opts.Vuex); | ||
} | ||
// Just a shared object to store the mounted object state | ||
@@ -42,5 +47,15 @@ let mountedInstances = {}; | ||
function mount(opts, mountedInstances) { | ||
function mount(opts, mountedInstances, props) { | ||
return new Promise((resolve, reject) => { | ||
mountedInstances.instance = new opts.Vue(opts.appOptions); | ||
const { | ||
store, | ||
globalEventDistributor | ||
} = props; | ||
const vueOpt = { | ||
...opts.appOptions, | ||
store | ||
} | ||
const extendedVue = opts.Vue.extend(); | ||
extendedVue.prototype.globalEventDistributor = globalEventDistributor; | ||
mountedInstances.instance = new extendedVue(vueOpt); | ||
resolve(); | ||
@@ -47,0 +62,0 @@ }); |
3433
4
59