docs: update anchor feature
parent
4eb26eaec3
commit
9b5a36186b
|
@ -9,7 +9,7 @@ const routes = [
|
||||||
{
|
{
|
||||||
path: '/components',
|
path: '/components',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
props: route => {
|
props: (route) => {
|
||||||
const name = route.path.split('/components/')[1].split('/')[0];
|
const name = route.path.split('/components/')[1].split('/')[0];
|
||||||
return { name, showDemo: true };
|
return { name, showDemo: true };
|
||||||
},
|
},
|
||||||
|
@ -18,9 +18,9 @@ const routes = [
|
||||||
{
|
{
|
||||||
path: '/iframe',
|
path: '/iframe',
|
||||||
component: Iframe,
|
component: Iframe,
|
||||||
children: demoRoutes.map(item => ({
|
children: demoRoutes.map((item) => ({
|
||||||
...item,
|
...item,
|
||||||
props: route => {
|
props: (route) => {
|
||||||
const hash = route.hash.replace('#', '');
|
const hash = route.hash.replace('#', '');
|
||||||
return { iframeName: hash };
|
return { iframeName: hash };
|
||||||
},
|
},
|
||||||
|
@ -29,7 +29,7 @@ const routes = [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
props: route => {
|
props: (route) => {
|
||||||
const name = route.path.split('/docs/vue/')[1].split('/')[0];
|
const name = route.path.split('/docs/vue/')[1].split('/')[0];
|
||||||
return { name, showApi: true };
|
return { name, showApi: true };
|
||||||
},
|
},
|
||||||
|
@ -116,4 +116,11 @@ export default new VueRouter({
|
||||||
mode: 'history',
|
mode: 'history',
|
||||||
fallback: false,
|
fallback: false,
|
||||||
routes,
|
routes,
|
||||||
|
scrollBehavior: (to) => {
|
||||||
|
if (to.hash) {
|
||||||
|
return {
|
||||||
|
selector: to.hash,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue