[Doc] add demo link (#1266)

This commit is contained in:
neverland 2018-06-12 09:17:50 +08:00 committed by GitHub
parent 409055195b
commit 963ee61a36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View File

@ -6,7 +6,11 @@
:title="title" :title="title"
left-arrow left-arrow
@click-left="onBack" @click-left="onBack"
/> >
<a slot="right" :href="demoLink" target="_blank">
<van-icon name="edit" />
</a>
</van-nav-bar>
<keep-alive> <keep-alive>
<router-view /> <router-view />
</keep-alive> </keep-alive>
@ -19,6 +23,10 @@ export default {
title() { title() {
const { name } = this.$route.meta; const { name } = this.$route.meta;
return name ? name.replace(/-/g, '') : ''; return name ? name.replace(/-/g, '') : '';
},
demoLink() {
return `https://github.com/youzan/vant/blob/dev/packages/${this.$route.meta.path}/demo/index.vue`;
} }
}, },
@ -44,6 +52,19 @@ body {
font-size: 15px; font-size: 15px;
text-transform: capitalize; text-transform: capitalize;
} }
.van-nav-bar__left,
.van-nav-bar__right {
cursor: pointer;
}
.van-nav-bar__right {
font-size: 16px;
.van-icon {
vertical-align: -3px;
}
}
} }
.van-doc-demo-section { .van-doc-demo-section {

View File

@ -59,6 +59,7 @@ const registerRoute = (isDemo) => {
path: `/${lang}/${path}`, path: `/${lang}/${path}`,
meta: { meta: {
lang, lang,
path,
name: page.title name: page.title
} }
}); });