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

427
Visualizações
Vue-router: get rid of trailing slash in the url

Setup: vue 2.6.14 & vue-router, my router config:

{
  mode:            'history',
  base:            document.location.pathname,
  routes: [
    {
      path:      '/',
      name:      'main',
      component: Main,
      props:     (route) => {
        return {
          id: route.query.id,
        };
      },
      pathToRegexpOptions: {
        strict: true,
      },
    },
  ],
}

Problem: I have urls like this

local.host/page/xxx_111.html?id=111

The router base is /page/xxx_111.html path. At some point I would like to change the url via programmatic navigation to just

local.host/page/xxx_111.html

in other words, to get rid of query params, but whatever I do, I always get

local.host/page/xxx_111.html/

with trailing slash :( How to solve this?

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

0

Solved by making router's path: '/*([\\w\\-]+_?[\\d]+.html)' which matches any url of type local.host/<ANYTHING>/xxx_111.html and calls like this.$router.push({ query: {} }) to get rid of url param w/o adding trailing slash to the url.

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