Doc update

This commit is contained in:
wanglin2 2023-09-23 16:28:17 +08:00
parent 464e57d019
commit 9fe321a127
3 changed files with 55 additions and 6 deletions

View File

@ -2,16 +2,24 @@
<div class="headerContainer"> <div class="headerContainer">
<div class="left"> <div class="left">
<div class="title" @click="toIndex"> <div class="title" @click="toIndex">
<img src="../../../assets/img/logo2.png" alt=""> <img src="../../../assets/img/logo2.png" alt="" />
SimpleMindMap SimpleMindMap
</div> </div>
</div> </div>
<div class="center"> <div class="center">
<div class="btn" @click="toIndex">{{ index }}</div>
<div class="btn" @click="toDemo">{{ demoName }}</div> <div class="btn" @click="toDemo">{{ demoName }}</div>
<div class="btn" @click="toHelp" :class="{ active: docType === 'help' }">
{{ helpDoc }}
</div>
<div class="btn" @click="toDev" :class="{ active: docType === 'doc' }">
{{ devDoc }}
</div>
<el-dropdown <el-dropdown
trigger="click" trigger="click"
placement="bottom-start" placement="bottom-start"
@command="handleCommand" @command="handleCommand"
v-if="docType === 'doc'"
> >
<span class="translateBtn"> <span class="translateBtn">
{{ currentLangName }}<i class="el-icon-arrow-down el-icon--right"></i> {{ currentLangName }}<i class="el-icon-arrow-down el-icon--right"></i>
@ -41,6 +49,7 @@ import t from '../i18n'
export default { export default {
data() { data() {
return { return {
docType: '',
lang: '', lang: '',
currentLangName: '', currentLangName: '',
otherLangList: [] otherLangList: []
@ -49,7 +58,16 @@ export default {
computed: { computed: {
demoName() { demoName() {
return t('demo', this.lang) return t('demo', this.lang)
} },
helpDoc() {
return t('help', this.lang)
},
devDoc() {
return t('dev', this.lang)
},
index() {
return t('index', this.lang)
},
}, },
watch: { watch: {
$route() { $route() {
@ -61,6 +79,12 @@ export default {
}, },
methods: { methods: {
init() { init() {
//
let docType = /^\/([^\/]+)\//.exec(this.$route.path)
if (docType && docType[1]) {
this.docType = docType[1]
}
//
let lang = /^\/doc\/([^\/]+)\//.exec(this.$route.path) let lang = /^\/doc\/([^\/]+)\//.exec(this.$route.path)
if (lang && lang[1]) { if (lang && lang[1]) {
this.lang = lang[1] this.lang = lang[1]
@ -87,6 +111,15 @@ export default {
return `/doc/${path}/` return `/doc/${path}/`
}) })
this.$router.push(url) this.$router.push(url)
},
toHelp() {
this.lang = 'zh'
this.$router.replace('/help/zh/')
},
toDev() {
this.$router.replace('/doc/zh/')
} }
} }
} }
@ -137,6 +170,10 @@ export default {
&:hover { &:hover {
color: #1ea59a; color: #1ea59a;
} }
&.active {
color: #1ea59a;
}
} }
.translateBtn { .translateBtn {

View File

@ -6,7 +6,19 @@ const data = {
demo: { demo: {
zh: '在线示例', zh: '在线示例',
en: 'Online Demo' en: 'Online Demo'
} },
help: {
zh: '帮助文档',
en: 'Help doc'
},
dev: {
zh: '开发文档',
en: 'Dev doc'
},
index: {
zh: '首页',
en: 'Home'
},
} }
const t = (str, lang) => { const t = (str, lang) => {

View File

@ -42,7 +42,7 @@ export default {
dataList: [ dataList: [
{ {
icon: 'iconstar', icon: 'iconstar',
value: 'Github star数量700+' value: 'Github star数量800+'
}, },
{ {
icon: 'iconfork', icon: 'iconfork',
@ -50,11 +50,11 @@ export default {
}, },
{ {
icon: 'iconxiazai', icon: 'iconxiazai',
value: 'npm总下载次数10000+' value: 'npm总下载次数15000+'
}, },
{ {
icon: 'iconteamwork', icon: 'iconteamwork',
value: '代码贡献者10+' value: '代码贡献者12+'
} }
], ],
functionList: [ functionList: [