FranckFreiburger / http-vue-loader

load .vue files from your html/js
MIT License
1.49k stars 275 forks source link

Nested vue-router routes #65

Open BinarySpike opened 5 years ago

BinarySpike commented 5 years ago

Based on this example: https://github.com/vuejs/vue-router/issues/298#issuecomment-406306711

// router.js
import Vue from "vue";
import Router from "vue-router";
import Component from "components/component.vue";

Vue.use(Router);

export default new Router({
  mode: "history",
  routes: [
    {
      path: "somepath",
      component: Component,
      children: Component.routes
    }
  ]
});
// components/component.vue
import SomeChildComponent from './';

export default {
  routes: [
    { path: "/somechildpath", component: SomeChildComponent },
  ]
};

Is there a way to do this with httpVueLoader? The magic is on children: Component.routes. When I define routes on the module.exports = I can't find it on the resolved promise:

<template>
  <h1>Test</h1>
  <router-view></router-view>
</template>
<script>
  module.exports = {
    routes = { '/test', component: httpVueLoader('test.vue') }
  }
</script>
<style scoped>
</style>
BinarySpike commented 5 years ago

Here's a vue issue that might shed some light on what I'm trying to accomplish with httpVueLoader: https://github.com/vuejs/vue-router/issues/715

Thanks!