Does vue-router addRouter add a route to add a route forward?

  1. I added some routes, followed by 404 routes

{

path: "/*",
name: "error-404",
meta: {
    title: "404-"
},
component: () => import("@/views/error-page/404.vue")

}
and then add a route, the latter route does not match at the time of access, is the latter route added to the front?

Mar.24,2021

just * as if you don't need /


ide/essentials/dynamic-matching.html-sharp%E5%8C%B9%E9%85%8D%E4%BC%98%E5%85%88%E7%BA%A7" rel=" nofollow noreferrer "> match priority : sometimes, multiple routes can be matched on the same path, and the matching priority is in the order in which the route is defined: whoever defines it first has the highest priority.
that is, when a new route is added, it is added to the back.

the code does special handling for * routes.
most people's understanding of * is a backup route, that is, when no other route matches, use the route corresponding to * .
Source src the 29-35 line of the create-route-map.js file below is the line that specifically puts the * route to the last side:

// ensure wildcard routes are always at the end
for (let i = 0, l = pathList.length; i < l; iPP) {
  if (pathList[i] === '*') {
    pathList.push(pathList.splice(i, 1)[0])
    l--
    i--
  }
}

to sum up, when adding routes, add routes in the order defined by the route, and finally change the * route to the last .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ef0a-2b7b8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ef0a-2b7b8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?