]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: mention in more places that names are unique.
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 14 Jul 2023 13:24:43 +0000 (15:24 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 14 Jul 2023 13:24:43 +0000 (15:24 +0200)
As pointed out in vuejs/router#1930

packages/docs/guide/advanced/dynamic-routing.md
packages/docs/guide/essentials/named-routes.md
packages/router/src/types/index.ts

index 86fd3aacbb3d7afc91bc63517160187081a4b469..17fab1eaec83bdf3d8cfaacca5e410935fe14edc 100644 (file)
@@ -62,7 +62,8 @@ There are few different ways to remove existing routes:
 
   ```js
   router.addRoute({ path: '/about', name: 'about', component: About })
-  // this will remove the previously added route because they have the same name and names are unique
+  // this will remove the previously added route because they have
+  // the same name and names are unique across all routes
   router.addRoute({ path: '/other', name: 'about', component: Other })
   ```
 
index 5c32986961dfb504b600e94b70c9238b8d5f8b83..883c5dd77b9d5e2f230fada78edd4943c1dbdcee 100644 (file)
@@ -39,3 +39,5 @@ router.push({ name: 'user', params: { username: 'erina' } })
 In both cases, the router will navigate to the path `/user/erina`.
 
 Full example [here](https://github.com/vuejs/vue-router/blob/dev/examples/named-routes/app.js).
+
+Each name **must be unique** across all routes. If you add the same name to multiple routes, the router will only keep the last one. You can read more about this [in the Dynamic Routing](../advanced/dynamic-routing.md#removing-routes) section.
index 76588f71331eba5549ca17474f06afa9905c9f43..e62e60db2f79f7f52ef3f69fe60ff9199bceaa5b 100644 (file)
@@ -246,7 +246,7 @@ export interface _RouteRecordBase extends PathParserOptions {
   alias?: string | string[]
 
   /**
-   * Name for the route record.
+   * Name for the route record. Must be unique.
    */
   name?: RouteRecordName