Can't access subroutes as entry point/HR not working when in subroute
-
I have my routes:
{ path: '/panel', component: panel, beforeEnter: reqAuth, children: [ { path: '', component: epPanelHome }, { path: 'events', component: epPanelEvents }, { path: 'groups', component: epPanelGroups } ] },
I can’t run app from link:
localhost:8080/panel/events
orgroups
I can access
localhost:8080
orlocalhost:8080/panel
but not any subroute…
I can run subroutes with links and it’s working ok (almost)The issue is somehow about config or something?
GET http://localhost:8080/panel/js/app.js
when I think it should not add/panel
Anyone with the same problem?EDIT: got reply on vue-router guthub. I had to disable history mode for dev.
Do you think it’s possible to use history mode with webpack ? -
I vaguely remember having to write out the full paths like this.
Not sure if this is the correct way. Feels like a bit of overhead.
(still have to sit down for a day and read the vue-router manual from A to Zpath: '/panel', component: panel, beforeEnter: reqAuth, children: [ { path: '/panel/home', component: epPanelHome }, { path: '/panel/events', component: epPanelEvents }, { path: '/panel/groups', component: epPanelGroups } ] },
in the vue component:
router.push( { path : '/panel/events', exact : true } )
-
It’s a matter of correctly setting up the publicPath. Use “/” for both dev and build publicPaths when on History Mode.
/* * NOTE! VueRouter "history" mode DOESN'T works for Cordova builds, * it is only to be used only for websites. * * If you decide to go with "history" mode, please also open /config/index.js * and set "build.publicPath" to something other than an empty string. * Example: '/' instead of current '' * * If switching back to default "hash" mode, don't forget to set the * build publicPath back to '' so Cordova builds work again. */