2016-07-27 14:15:02 +08:00
|
|
|
<style lang="css">
|
2016-11-01 18:28:20 +08:00
|
|
|
@import 'highlight.js/styles/color-brewer.css';
|
2016-07-27 14:15:02 +08:00
|
|
|
@import 'assets/styles/common.css';
|
2017-01-23 16:02:58 +08:00
|
|
|
@import 'assets/styles/fonts/style.css';
|
2016-07-27 14:15:02 +08:00
|
|
|
|
|
|
|
html, body {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
2016-08-23 19:15:15 +08:00
|
|
|
height: 100%;
|
2016-07-27 14:15:02 +08:00
|
|
|
}
|
|
|
|
|
2016-08-23 19:15:15 +08:00
|
|
|
#app {
|
|
|
|
height: 100%;
|
2016-08-23 16:57:58 +08:00
|
|
|
}
|
|
|
|
|
2016-08-23 19:15:15 +08:00
|
|
|
body {
|
2017-01-23 16:02:58 +08:00
|
|
|
font-family: 'Helvetica Neue',Helvetica,'PingFang SC','Hiragino Sans GB','Microsoft YaHei',SimSun,sans-serif;
|
|
|
|
overflow: auto;
|
|
|
|
font-weight: 400;
|
2016-09-20 17:09:18 +08:00
|
|
|
-webkit-font-smoothing: antialiased;
|
2016-07-27 14:15:02 +08:00
|
|
|
}
|
|
|
|
|
2017-01-12 17:24:02 +08:00
|
|
|
a {
|
|
|
|
color: #4078c0;
|
2017-01-23 16:02:58 +08:00
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
2017-03-24 15:38:31 +08:00
|
|
|
code {
|
|
|
|
background-color: #f9fafc;
|
|
|
|
padding: 0 4px;
|
|
|
|
border: 1px solid #eaeefb;
|
|
|
|
border-radius: 4px;
|
|
|
|
}
|
|
|
|
|
2017-01-23 16:02:58 +08:00
|
|
|
button, input, select, textarea {
|
|
|
|
font-family: inherit;
|
|
|
|
font-size: inherit;
|
|
|
|
line-height: inherit;
|
|
|
|
color: inherit;
|
2016-09-28 12:35:24 +08:00
|
|
|
}
|
|
|
|
|
2016-08-30 19:30:58 +08:00
|
|
|
.hljs {
|
2016-09-18 22:01:26 +08:00
|
|
|
line-height: 1.8;
|
|
|
|
font-family: Menlo, Monaco, Consolas, Courier, monospace;
|
|
|
|
font-size: 12px;
|
|
|
|
padding: 18px 24px;
|
2016-08-30 19:30:58 +08:00
|
|
|
background-color: #f9fafc;
|
2016-09-18 22:01:26 +08:00
|
|
|
border: solid 1px #eaeefb;
|
2016-08-30 19:30:58 +08:00
|
|
|
margin-bottom: 25px;
|
2016-11-07 16:25:56 +08:00
|
|
|
border-radius: 4px;
|
2016-09-20 17:09:18 +08:00
|
|
|
-webkit-font-smoothing: auto;
|
2016-08-30 19:30:58 +08:00
|
|
|
}
|
|
|
|
|
2016-08-23 19:15:15 +08:00
|
|
|
.main-cnt {
|
|
|
|
margin-top: -80px;
|
|
|
|
padding: 80px 0 120px;
|
2016-07-27 14:15:02 +08:00
|
|
|
box-sizing: border-box;
|
2016-08-23 19:15:15 +08:00
|
|
|
min-height: 100%;
|
2016-07-27 14:15:02 +08:00
|
|
|
}
|
|
|
|
|
2016-08-25 15:54:45 +08:00
|
|
|
.container,
|
|
|
|
.page-container {
|
2016-09-13 20:02:33 +08:00
|
|
|
width: 1140px;
|
2016-11-18 16:49:07 +08:00
|
|
|
padding: 0 30px;
|
2016-08-25 15:54:45 +08:00
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.page-container {
|
|
|
|
padding-top: 55px;
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
font-size: 28px;
|
|
|
|
color: #1f2d3d;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
h3 {
|
|
|
|
font-size: 22px;
|
|
|
|
}
|
|
|
|
h2, h3, h4, h5 {
|
|
|
|
font-weight: normal;
|
|
|
|
color: #1f2f3d;
|
2016-11-04 16:59:59 +08:00
|
|
|
|
|
|
|
&:hover a {
|
|
|
|
opacity: .4;
|
|
|
|
}
|
|
|
|
|
|
|
|
a {
|
|
|
|
float: left;
|
|
|
|
margin-left: -20px;
|
|
|
|
opacity: 0;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
opacity: .4;
|
|
|
|
}
|
|
|
|
}
|
2016-08-25 15:54:45 +08:00
|
|
|
}
|
2017-03-24 15:38:31 +08:00
|
|
|
|
2016-08-25 15:54:45 +08:00
|
|
|
p {
|
|
|
|
font-size: 14px;
|
|
|
|
color: #5e6d82;
|
2017-03-24 15:38:31 +08:00
|
|
|
line-height: 1.5em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tip {
|
|
|
|
padding: 8px 16px;
|
|
|
|
background-color: #ECF8FF;
|
|
|
|
border-radius: 4px;
|
|
|
|
border-left: #50bfff 5px solid;
|
2017-07-20 16:09:44 +08:00
|
|
|
margin-top: 20px;
|
2017-03-24 15:38:31 +08:00
|
|
|
|
|
|
|
code {
|
|
|
|
background-color: rgba(#fff, .7);
|
|
|
|
color: #445368;
|
|
|
|
}
|
2016-08-25 15:54:45 +08:00
|
|
|
}
|
2016-07-27 14:15:02 +08:00
|
|
|
}
|
|
|
|
.demo {
|
|
|
|
margin: 20px 0;
|
|
|
|
}
|
2016-09-14 18:38:38 +08:00
|
|
|
@media (max-width: 1140px) {
|
|
|
|
.container,
|
|
|
|
.page-container {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
2016-11-18 16:49:07 +08:00
|
|
|
|
|
|
|
@media (max-width: 768px) {
|
|
|
|
.container,
|
|
|
|
.page-container {
|
|
|
|
padding: 0 20px;
|
|
|
|
}
|
|
|
|
}
|
2016-07-27 14:15:02 +08:00
|
|
|
</style>
|
|
|
|
|
|
|
|
<template>
|
2016-07-27 17:05:28 +08:00
|
|
|
<div id="app">
|
2016-11-13 02:34:39 +08:00
|
|
|
<main-header v-if="lang !== 'play'"></main-header>
|
2016-08-23 19:15:15 +08:00
|
|
|
<div class="main-cnt">
|
|
|
|
<router-view></router-view>
|
|
|
|
</div>
|
2016-11-13 02:34:39 +08:00
|
|
|
<main-footer v-if="lang !== 'play'"></main-footer>
|
2016-07-27 17:05:28 +08:00
|
|
|
</div>
|
2016-07-27 14:15:02 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2016-11-10 21:46:55 +08:00
|
|
|
import { use } from 'main/locale';
|
|
|
|
import zhLocale from 'main/locale/lang/zh-CN';
|
|
|
|
import enLocale from 'main/locale/lang/en';
|
|
|
|
use(location.href.indexOf('zh-CN') > -1 ? zhLocale : enLocale);
|
|
|
|
|
2016-07-27 14:15:02 +08:00
|
|
|
export default {
|
2016-09-08 18:11:18 +08:00
|
|
|
name: 'app',
|
2016-11-10 21:46:55 +08:00
|
|
|
|
|
|
|
computed: {
|
|
|
|
lang() {
|
|
|
|
return this.$route.path.split('/')[1] || 'zh-CN';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
lang() {
|
|
|
|
this.localize();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-11-04 16:59:59 +08:00
|
|
|
methods: {
|
2016-11-10 21:46:55 +08:00
|
|
|
localize() {
|
|
|
|
use(this.lang === 'zh-CN' ? zhLocale : enLocale);
|
|
|
|
},
|
|
|
|
|
2016-11-04 16:59:59 +08:00
|
|
|
renderAnchorHref() {
|
2016-11-06 15:56:41 +08:00
|
|
|
if (/changelog/g.test(location.href)) return;
|
2016-11-04 16:59:59 +08:00
|
|
|
const anchors = document.querySelectorAll('h2 a,h3 a');
|
|
|
|
const basePath = location.href.split('#').splice(0, 2).join('#');
|
|
|
|
|
|
|
|
[].slice.call(anchors).forEach(a => {
|
|
|
|
const href = a.getAttribute('href');
|
|
|
|
a.href = basePath + href;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
goAnchor() {
|
|
|
|
if (location.href.match(/#/g).length > 1) {
|
2016-12-20 16:38:21 +08:00
|
|
|
const anchor = location.href.match(/#[^#]+$/g);
|
|
|
|
if (!anchor) return;
|
|
|
|
const elm = document.querySelector(anchor[0]);
|
2016-11-04 16:59:59 +08:00
|
|
|
if (!elm) return;
|
|
|
|
|
|
|
|
setTimeout(_ => {
|
2016-12-20 16:38:21 +08:00
|
|
|
document.documentElement.scrollTop = document.body.scrollTop = elm.offsetTop + 120;
|
2016-11-04 16:59:59 +08:00
|
|
|
}, 50);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
2016-11-10 21:46:55 +08:00
|
|
|
this.localize();
|
2016-11-04 16:59:59 +08:00
|
|
|
this.renderAnchorHref();
|
|
|
|
this.goAnchor();
|
|
|
|
},
|
|
|
|
|
2016-09-08 18:11:18 +08:00
|
|
|
created() {
|
|
|
|
window.addEventListener('hashchange', () => {
|
2016-11-04 16:59:59 +08:00
|
|
|
if (location.href.match(/#/g).length < 2) {
|
|
|
|
document.documentElement.scrollTop = document.body.scrollTop = 0;
|
|
|
|
this.renderAnchorHref();
|
|
|
|
} else {
|
|
|
|
this.goAnchor();
|
|
|
|
}
|
2016-09-08 18:11:18 +08:00
|
|
|
});
|
|
|
|
}
|
2016-07-27 14:15:02 +08:00
|
|
|
};
|
|
|
|
</script>
|