Skip to content

Commit 9b5a361

Browse files
committed
docs: update anchor feature
1 parent 4eb26ea commit 9b5a361

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

antdv-demo/site/router.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const routes = [
99
{
1010
path: '/components',
1111
component: Layout,
12-
props: route => {
12+
props: (route) => {
1313
const name = route.path.split('/components/')[1].split('/')[0];
1414
return { name, showDemo: true };
1515
},
@@ -18,9 +18,9 @@ const routes = [
1818
{
1919
path: '/iframe',
2020
component: Iframe,
21-
children: demoRoutes.map(item => ({
21+
children: demoRoutes.map((item) => ({
2222
...item,
23-
props: route => {
23+
props: (route) => {
2424
const hash = route.hash.replace('#', '');
2525
return { iframeName: hash };
2626
},
@@ -29,7 +29,7 @@ const routes = [
2929
{
3030
path: '/',
3131
component: Layout,
32-
props: route => {
32+
props: (route) => {
3333
const name = route.path.split('/docs/vue/')[1].split('/')[0];
3434
return { name, showApi: true };
3535
},
@@ -116,4 +116,11 @@ export default new VueRouter({
116116
mode: 'history',
117117
fallback: false,
118118
routes,
119+
scrollBehavior: (to) => {
120+
if (to.hash) {
121+
return {
122+
selector: to.hash,
123+
};
124+
}
125+
},
119126
});

0 commit comments

Comments
 (0)