feat(cli): support locales

This commit is contained in:
陈嘉涵
2019-12-06 15:51:20 +08:00
parent 6bd858fac5
commit dc6cc6c5af
16 changed files with 336 additions and 135 deletions

View File

@@ -8,7 +8,7 @@
<template v-for="(group, index) in config.nav">
<demo-home-nav
:group="group"
:base="$vantLang"
:lang="lang"
:key="index"
/>
</template>
@@ -24,10 +24,21 @@ export default {
DemoHomeNav
},
data() {
return {
config: config.site
};
computed: {
lang() {
const { lang } = this.$route.meta || {};
return lang;
},
config() {
const { locales } = config.site;
if (locales) {
return locales[this.lang];
}
return config.site;
}
}
};
</script>

View File

@@ -18,7 +18,7 @@
<template v-for="(navItem, index) in group.items">
<van-cell
:key="index"
:to="'/' + navItem.path"
:to="`${base}/${navItem.path}`"
:title="navItem.title"
is-link
/>
@@ -39,7 +39,7 @@ export default {
},
props: {
base: String,
lang: String,
group: Object
},
@@ -47,6 +47,12 @@ export default {
return {
active: []
};
},
computed: {
base() {
return this.lang ? `/${this.lang}` : '';
}
}
};
</script>

View File

@@ -19,8 +19,7 @@ export default {
computed: {
title() {
const route = this.$route || {};
const { name } = route.meta || {};
const { name } = this.$route.meta || {};
return name ? name.replace(/-/g, '') : '';
}
},