File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,28 @@ They are primarily used to guard navigations either by redirecting it or canceli
49
49
11 . DOM updates triggered.
50
50
12 . Call callbacks passed to ` next ` in ` beforeRouteEnter ` guards with instantiated instances.
51
51
52
+ Every guard function receives two arguments:
53
+
54
+ ` to ` : the target route location in a normalized format being navigated to.
55
+
56
+ ` from ` : the current route location in a normalized format being navigated away from.
57
+
58
+ ## RouterView slot
59
+
60
+ The RouterView component exposes a slot that can be used to render the route component
61
+
62
+ ``` vue
63
+ <template>
64
+ <router-view v-slot="{ Component }">
65
+ <transition>
66
+ <keep-alive>
67
+ <component :is="Component" :some-prop="prop"/>
68
+ </keep-alive>
69
+ </transition>
70
+ </router-view>
71
+ </template>
72
+ ```
73
+
52
74
## Transitions
53
75
54
76
``` vue
@@ -90,3 +112,30 @@ const routes = [
90
112
</RouterView>
91
113
</template>
92
114
```
115
+
116
+ ## Route Meta fields
117
+
118
+ Attach arbitrary information to routes like: transition names, or roles to control who can access the route, etc.
119
+
120
+ ``` js
121
+ const routes = [
122
+ {
123
+ path: ' /posts' ,
124
+ component: PostsLayout,
125
+ children: [
126
+ {
127
+ path: ' new' ,
128
+ component: PostsNew,
129
+ // only authenticated users can create posts
130
+ meta: { requiresAuth: true },
131
+ },
132
+ {
133
+ path: ' :id' ,
134
+ component: PostsDetail,
135
+ // anybody can read a post
136
+ meta: { requiresAuth: false },
137
+ },
138
+ ],
139
+ },
140
+ ]
141
+ ```
You can’t perform that action at this time.
0 commit comments