Reduce initial bundle size

This commit is contained in:
syuilo 2019-05-21 04:21:43 +09:00
parent 3cc2049fb3
commit cd4c7689b7
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
13 changed files with 67 additions and 46 deletions

View file

@ -449,12 +449,25 @@ export default (callback: (launch: (router: VueRouter) => [Vue, MiOS], os: MiOS)
getMetaSync: os.getMetaSync,
signout: os.signout,
new(vm, props) {
const x = new vm({
parent: this,
propsData: props
}).$mount();
document.body.appendChild(x.$el);
return x;
if (typeof vm === 'function') {
return new Promise((res) => {
vm().then(vm => {
const x = new vm({
parent: this,
propsData: props
}).$mount();
document.body.appendChild(x.$el);
res(x);
});
});
} else {
const x = new vm({
parent: this,
propsData: props
}).$mount();
document.body.appendChild(x.$el);
return x;
}
},
dialog(opts) {
const vm = this.new(Dialog, opts);