split.js 555 B

1234567891011121314151617181920212223
  1. import Vue from '../../../../dist/vue.runtime.common.js'
  2. // async component!
  3. const Foo = () => import('./async-foo')
  4. const Bar = () => import('./async-bar') // eslint-disable-line
  5. export default context => {
  6. return new Promise(resolve => {
  7. context.msg = 'hello'
  8. const vm = new Vue({
  9. render(h) {
  10. return h('div', [context.url, h(Foo)])
  11. }
  12. })
  13. // simulate router.onReady
  14. Foo().then(comp => {
  15. // resolve now to make the render sync
  16. Foo.resolved = Vue.extend(comp.default)
  17. resolve(vm)
  18. })
  19. })
  20. }