http-vue-loader icon indicating copy to clipboard operation
http-vue-loader copied to clipboard

Nested vue-router routes

Open BinarySpike opened this issue 5 years ago • 1 comments

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 avatar Mar 18 '19 22:03 BinarySpike

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!

BinarySpike avatar Mar 18 '19 23:03 BinarySpike