framework7io / framework7

Full featured HTML framework for building iOS & Android apps
http://framework7.io
MIT License
18.08k stars 3.23k forks source link

Fix router-class.js for correct navigate if used route path format like `/:optionalParam(any+[regexp]+)?` #4179

Closed 100100101 closed 1 year ago

100100101 commented 1 year ago

For example: We have 2 routes

const view: View.Parameters = {
    routes: [
        {
            name: 'home',
            path: '/:anyOptionalParam(any+[regex]+)?',
        },
        {
            name: 'about',
            path: '/about',
        },
    ],
}
  1. If started at 'about' page (http://localhost/about)
  2. Call
    currentViewRouter.navigate({
    name: 'home'
    })
  3. Have error Uncaught (in promise) Error: Framework7: can't construct URL for route with name "home"