Skip to content

Commit e77980c

Browse files
committed
add arbitrary route properties to vue-router migration guide
1 parent 9955e75 commit e77980c

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/guide/migration-vue-router.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,44 @@ alias: ['/manage', '/administer', '/administrate']
200200
</div>
201201
{% endraw %}
202202

203+
### Arbitrary Route Properties
204+
205+
Arbitrary route properties must now be scoped under the new meta property, to avoid conflicts with future features. So for example, if you had defined:
206+
207+
``` js
208+
'/admin': {
209+
component: AdminPanel,
210+
requiresAuth: true
211+
}
212+
```
213+
214+
Then you would now update it to:
215+
216+
``` js
217+
{
218+
path: '/admin',
219+
component: AdminPanel,
220+
meta: {
221+
requiresAuth: true
222+
}
223+
}
224+
```
225+
226+
Then when later accessing this property on a route, you will still go through meta. For example:
227+
228+
``` js
229+
if (route.meta.requiresAuth) {
230+
// ...
231+
}
232+
```
233+
234+
{% raw %}
235+
<div class="upgrade-path">
236+
<h4>Upgrade Path</h4>
237+
<p>Run the <a href="https://github.com/vuejs/vue-migration-helper">migration helper</a> on your codebase to find examples of arbitrary route properties not scoped under meta.</p>
238+
</div>
239+
{% endraw %}
240+
203241
## Route Matching
204242

205243
Route matching now uses [path-to-regexp](https://github.com/pillarjs/path-to-regexp) under the hood, making it much more flexible than previously.

0 commit comments

Comments
 (0)