mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-11-30 03:07:36 +08:00
use hash
This commit is contained in:
parent
65d6938ddf
commit
f7cc340f3c
@ -81,6 +81,11 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'app'
|
name: 'app',
|
||||||
|
created() {
|
||||||
|
window.addEventListener('hashchange', () => {
|
||||||
|
document.body.scrollTop = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="footer-main">
|
<div class="footer-main">
|
||||||
<p class="footer-main-title">Element 1.0 Hydrogen</p>
|
<p class="footer-main-title">Element 1.0 Hydrogen</p>
|
||||||
<span class="footer-main-link">反馈建议</span>
|
<span class="footer-main-link">反馈建议</span>
|
||||||
<span class="footer-main-link"><router-link to="/changelog">更新日志</router-link></span>
|
<span class="footer-main-link"><router-link to="/changelog">更新日志</router-link></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer-social">
|
<div class="footer-social">
|
||||||
<el-popover
|
<el-popover
|
||||||
ref="weixin"
|
ref="weixin"
|
||||||
@ -72,10 +72,12 @@
|
|||||||
line-height: 120px;
|
line-height: 120px;
|
||||||
|
|
||||||
.footer-popover {
|
.footer-popover {
|
||||||
padding: 0;
|
.el-popover {
|
||||||
min-width: 120px;
|
padding: 0;
|
||||||
line-height: normal;
|
min-width: 120px;
|
||||||
box-shadow: 0 0 11px 0 rgba(174, 187, 211, 0.24);
|
line-height: normal;
|
||||||
|
box-shadow: 0 0 11px 0 rgba(174, 187, 211, 0.24);
|
||||||
|
}
|
||||||
|
|
||||||
.footer-popover-title {
|
.footer-popover-title {
|
||||||
border-bottom: solid 1px #eaeefb;
|
border-bottom: solid 1px #eaeefb;
|
||||||
|
@ -18,28 +18,9 @@ Vue.component('main-header', MainHeader);
|
|||||||
Vue.component('side-nav', SideNav);
|
Vue.component('side-nav', SideNav);
|
||||||
Vue.component('footer-nav', FooterNav);
|
Vue.component('footer-nav', FooterNav);
|
||||||
|
|
||||||
const scrollBehavior = (to, from, savedPosition) => {
|
|
||||||
if (savedPosition) {
|
|
||||||
// savedPosition is only available for popstate navigations.
|
|
||||||
return savedPosition;
|
|
||||||
} else {
|
|
||||||
// new navigation.
|
|
||||||
// scroll to anchor
|
|
||||||
if (to.hash) {
|
|
||||||
return { anchor: true };
|
|
||||||
}
|
|
||||||
// explicitly control scroll position
|
|
||||||
// check if any matched route config has meta that requires scrolling to top
|
|
||||||
if (to.matched.some(m => m.meta.scrollToTop)) {
|
|
||||||
return { x: 0, y: 0 };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
mode: 'history',
|
mode: 'hash',
|
||||||
base: __dirname,
|
base: __dirname,
|
||||||
scrollBehavior,
|
|
||||||
routes: configRouter
|
routes: configRouter
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,8 +4,7 @@ const registerRoute = (config) => {
|
|||||||
let route = [{
|
let route = [{
|
||||||
path: '/component',
|
path: '/component',
|
||||||
component: require('./pages/component.vue'),
|
component: require('./pages/component.vue'),
|
||||||
children: [],
|
children: []
|
||||||
scrollToTop: true
|
|
||||||
}];
|
}];
|
||||||
function addRoute(page) {
|
function addRoute(page) {
|
||||||
const component = require(`./docs${page.path}.md`);
|
const component = require(`./docs${page.path}.md`);
|
||||||
@ -14,8 +13,7 @@ const registerRoute = (config) => {
|
|||||||
path: page.path.slice(1),
|
path: page.path.slice(1),
|
||||||
meta: {
|
meta: {
|
||||||
title: page.title || page.name,
|
title: page.title || page.name,
|
||||||
description: page.description,
|
description: page.description
|
||||||
scrollToTop: true
|
|
||||||
},
|
},
|
||||||
component: component.default || component
|
component: component.default || component
|
||||||
});
|
});
|
||||||
@ -45,7 +43,6 @@ let guideRoute = {
|
|||||||
path: '/guide',
|
path: '/guide',
|
||||||
name: '指南',
|
name: '指南',
|
||||||
component: require('./pages/guide.vue'),
|
component: require('./pages/guide.vue'),
|
||||||
meta: { scrollToTop: true },
|
|
||||||
children: [{
|
children: [{
|
||||||
path: 'design',
|
path: 'design',
|
||||||
name: '设计原则',
|
name: '设计原则',
|
||||||
@ -60,20 +57,17 @@ let guideRoute = {
|
|||||||
let resourceRoute = {
|
let resourceRoute = {
|
||||||
path: '/resource',
|
path: '/resource',
|
||||||
name: '资源',
|
name: '资源',
|
||||||
meta: { scrollToTop: true },
|
|
||||||
component: require('./pages/resource.vue')
|
component: require('./pages/resource.vue')
|
||||||
};
|
};
|
||||||
|
|
||||||
let indexRoute = {
|
let indexRoute = {
|
||||||
path: '/',
|
path: '/',
|
||||||
name: '首页',
|
name: '首页',
|
||||||
meta: { scrollToTop: true },
|
|
||||||
component: require('./pages/index.vue')
|
component: require('./pages/index.vue')
|
||||||
};
|
};
|
||||||
|
|
||||||
let changeLogRoute = {
|
let changeLogRoute = {
|
||||||
path: '/changelog',
|
path: '/changelog',
|
||||||
meta: { scrollToTop: true },
|
|
||||||
component: require('./pages/changelog.vue')
|
component: require('./pages/changelog.vue')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ export default {
|
|||||||
|
|
||||||
const options = this.options;
|
const options = this.options;
|
||||||
const popper = this.popper || this.$refs.popper;
|
const popper = this.popper || this.$refs.popper;
|
||||||
const reference = this.reference || this.$refs.reference || this.$slots.reference[0].elm;;
|
const reference = this.reference || this.$refs.reference || this.$slots.reference[0].elm;
|
||||||
|
|
||||||
if (!popper || !reference) return;
|
if (!popper || !reference) return;
|
||||||
if (this.visibleArrow) {
|
if (this.visibleArrow) {
|
||||||
|
Loading…
Reference in New Issue
Block a user