]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
Update redirect example syntax (#243)
authorJeffrey Biles <bilesjeffrey@gmail.com>
Wed, 13 May 2020 18:48:58 +0000 (11:48 -0700)
committerGitHub <noreply@github.com>
Wed, 13 May 2020 18:48:58 +0000 (20:48 +0200)
`routes` should be an array instead of an object

README.md

index cc51ca6e55f7b90f4bcd822ac775b0b5d5951e8e..dcbf34d2a51668ad359fc5d9b94938814d55bfe0 100644 (file)
--- a/README.md
+++ b/README.md
@@ -60,18 +60,22 @@ These are technically breaking changes but they fix an inconsistent behavior.
 - Because of the change above, relative children path `redirect` on an empty path are not supported anymore. Use named routes instead:
   ```js
   // replace
-  let routes = {
-    path: '/parent',
-    children: [{ path: '', redirect: 'home' }, { path: 'home' }],
-  }
+  let routes = [
+    {
+      path: '/parent',
+      children: [{ path: '', redirect: 'home' }, { path: 'home' }],
+    }
+  ]
   // with
-  let routes = {
-    path: '/parent',
-    children: [
-      { path: '', redirect: { name: 'home' } },
-      { path: 'home', name: 'home' },
-    ],
-  }
+  let routes = [
+    {
+      path: '/parent',
+      children: [
+        { path: '', redirect: { name: 'home' } },
+        { path: 'home', name: 'home' },
+      ],
+    }
+   ]
   ```
   Note this will work if `path` was `/parent/` as the relative location `home` to `/parent/` is indeed `/parent/home` but the relative location of `home` to `/parent` is `/home`