From: Jeffrey Biles Date: Wed, 13 May 2020 18:48:58 +0000 (-0700) Subject: Update redirect example syntax (#243) X-Git-Tag: v4.0.0-alpha.12~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=54059f243cfc25405100d7bfa0231e0e61e6e44a;p=thirdparty%2Fvuejs%2Frouter.git Update redirect example syntax (#243) `routes` should be an array instead of an object --- diff --git a/README.md b/README.md index cc51ca6e..dcbf34d2 100644 --- 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`