Skip to content

Commit cc82713

Browse files
committed
docs: changes for 0.7.0
1 parent d5afbbf commit cc82713

File tree

4 files changed

+41
-5
lines changed

4 files changed

+41
-5
lines changed

docs/en/api/go.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,11 @@ Programatically navigate to a new route.
2828
```
2929

3030
For details about the `name` Object format, see [Named Routes](../named.md).
31+
32+
- When using the `path` format and navigating to a relative path, you can also pass in the `append: true` option, so that the relative path is always **appended** to the current path. For example:
33+
34+
- Going from `/a` to `b` without `append: true` will arrive at `/b`;
35+
36+
- Going from `/a` to `b` with `append: true` will arrive at `/a/b`.
37+
38+
- Both formats also accept the `replace: true` option, which makes the navigation to replace the current history entry instead of creating a new one.

docs/en/link.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,37 @@
2323

2424
#### Active Link Class
2525

26-
Elements with `v-link` will automatically get corresponding class names when the current path matches its `v-link` URL:
26+
Elements with `v-link` will automatically get corresponding class names when the current path matches its `v-link` URL. The default class to be applied is `.v-link-active` and the default matching behavior is **inclusive match**. For example, an element with `v-link="/a"` will get this class applied as long as the current path starts with `/a`.
2727

28-
- The `.v-link-active` class is applied to the element when the current path starts with the `v-link` URL. For example, an element with `v-link="/a"` will get this class as long as the current path starts with `/a`.
28+
It is also possible to configure the matching behavior so that the active class is only applied when the paths match exactly, using the `exact` inline option:
2929

30-
- The `.v-link-active-exact` class is applied when the current path is an exact match of the `v-link` URL.
30+
``` html
31+
<a v-link="{ path: '/a', exact: true }"></a>
32+
```
33+
34+
The active link class name can be configured with the `linkActiveClass` option when creating the router instance. It can also be overridden with the `activeClas` inline option:
35+
36+
``` html
37+
<a v-link="{ path: '/a', activeClass: 'custom-active-class' }"></a>
38+
```
39+
40+
#### Other Configuration Options
41+
42+
- **replace**
43+
44+
A link with `replace: true` will call `router.replace()` instead of `router.go()` when clicked, so the navigation will not leave a history record.
45+
46+
``` html
47+
<a v-link="{ path: '/abc', replace: true }"></a>
48+
```
49+
50+
- **append**
51+
52+
A relative link with `append: true` always append the relative path to the current path. For example, assuming we are navigating from `/a` to a relative link `b`, without `append: true` we will end up at `/b`, but with `append: true` we will end up at `/a/b`.
3153

32-
The active link class name can be configured with the `linkActiveClass` option when creating the router instance. The exact match class simply appends `-exact` postfix to the provided class name.
54+
``` html
55+
<a v-link="{ path: 'relative/path', append: true }"></a>
56+
```
3357

3458
#### Additional Notes
3559

docs/en/options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ There are a number of options you can use to customize the router behavior when
3838

3939
- default: `"v-link-active"`
4040

41-
Configures the class to be applied to `v-link` elements when the current path matches its URL. The base class is applied as long as the current path starts with the `v-link` URL; when the current path matches the `v-link` URL exactly, an additional class with the `-exact` postfix will also be applied,the default being `v-link-active-exact`. So if you configure the class to be `my-custom-active`, the exact match class will be `my-custom-active-exact`.
41+
Configures the class to be applied to `v-link` elements when the current link is active. The matching behavior and the class can also be individually configured for each `v-link`.
4242

4343
#### saveScrollPosition
4444

docs/en/route.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ A route object exposes the following properties:
2020

2121
The router instance that is managing this route (and its owner component).
2222

23+
- **$route.matched**
24+
25+
An array containing the route configuration objects for all matched segments in the current route.
26+
2327
### Custom Fields
2428

2529
In addition to the built-in properties, custom fields defined in the route config will also be merged on to the route object. For example:

0 commit comments

Comments
 (0)