Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

426
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!