Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

424
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda