Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

209
Visualizações
vue-router 4 redirects default url to page not found

I am migrating my vue application vue 2 to vue 3 by following vue migration official documentation. I have updated vue-router package. After updating router.js if i am running the application in my local by default it is routing to 404 page not found component.

Previously, It was routing to overview page(http://localhost:8080/overview). Now this url is routing to page not found. Here is my router.js

router.js

    /* [IMPORT] Library */
import { createRouter, createWebHistory } from 'vue-router';
/* [IMPORT] Common module */
import store                  from '~/common/store';
/* [IMPORT] modules */
import devModule              from '~/module/devModule';
import pageNotFoundPage       from '~/page/common/pageNotFound';

/* [IMPORT][PAGE] OverView */
import overviewPage           from '~/page/overview/overviewPage';

const routes = [

        { path: '/'   , redirect: '/dev'},
        { path: '/dev', component: devModule, children: [
            /* Default routing*/
            { path: '', redirect: 'overview/overview'},
            /* OVERVIEW */
            { path: 'overview', redirect: 'overview/overview'},
            { path: 'overview/overview' ,   component: overviewPage}
        ]},
        /* [404] anything else... */
        { path: '/:catchAll(.*)'   , component: pageNotFoundPage },
    ];

    export const router = createRouter({ history: createWebHistory(), routes });

/* [intercepter] */
router.beforeEach(function(to, from, next) {
    // 1. Update current URL :: for store
    store.commit('moveMenu',to.path);
    // x. go to next menu
    next();
});
export default router;

Why it is not routing to overview page after migration? Any suggestion or guide will be helpful related to this.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You should concatenate the child route path with parent one like :

http://localhost:8080/dev/overview

for more details check nested-routes section in official docs

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda