split.js 575 B

1234567891011121314151617181920212223242526
  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', [
  11. context.url,
  12. h(Foo)
  13. ])
  14. }
  15. })
  16. // simulate router.onReady
  17. Foo().then(comp => {
  18. // resolve now to make the render sync
  19. Foo.resolved = Vue.extend(comp)
  20. resolve(vm)
  21. })
  22. })
  23. }