mirror of
https://github.com/youzan/vant.git
synced 2025-10-18 17:51:54 +00:00
feat(cli): support locales
This commit is contained in:
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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, '') : '';
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user