vant/docs/src/DocsApp.vue
2019-05-21 15:24:40 +08:00

68 lines
1.2 KiB
Vue

<template>
<div class="app">
<van-doc
:base="base"
:config="config"
active="Vue 组件"
:lang="$vantLang"
:simulators="simulators"
:search-config="searchConfig"
:current-simulator="currentSimulator"
>
<router-view @changeDemoURL="onChangeDemoURL" />
</van-doc>
</div>
</template>
<script>
import docConfig from './doc.config';
export default {
data() {
this.searchConfig = docConfig.searchConfig;
return {
simulators: [`mobile.html${location.hash}`],
demoURL: ''
};
},
computed: {
base() {
return `/${this.$vantLang}`;
},
config() {
return docConfig[this.$vantLang];
},
currentSimulator() {
const { name } = this.$route;
return name && name.indexOf('demo') !== -1 ? 1 : 0;
}
},
methods: {
onChangeDemoURL(url) {
this.simulators = [this.simulators[0], url];
}
}
};
</script>
<style lang="less">
.van-doc-intro {
padding-top: 20px;
font-family: "Dosis", "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
text-align: center;
&__logo {
width: 120px;
height: 120px;
}
p {
margin-bottom: 20px;
}
}
</style>