提取 layout 和登录页面的公用切换语言逻辑
Former-commit-id: 43ed6a96bd897366861aed0915b87f2b65df4710 [formerly 43ed6a96bd897366861aed0915b87f2b65df4710 [formerly 43ed6a96bd897366861aed0915b87f2b65df4710 [formerly 43ed6a96bd897366861aed0915b87f2b65df4710 [formerly 777111bc2dbc71b3ff2549572e38e78d3035d9ca [formerly e6ef292ed2b174fc179c662698b564887654b68c]]]]] Former-commit-id: 509743dec34795b62814f46da3fcdc8b87bc95af Former-commit-id: 930b9e6713d8330b182e7f9cac621b2179c6515c Former-commit-id: 95707d671efc130e783bb46a87fbd0ec10f143b6 [formerly 3fa108f2d027a562ac3e81635a815197b42171f1] Former-commit-id: 9937d0028823f1c4b89d463a1f1f25bbee245d67 Former-commit-id: 525670c8db99a28555c847a506613fa852c7bb50 Former-commit-id: bbb54be5298d9cde045fae85c20b6f91bee642e7 Former-commit-id: c8cbad1e3bad52b4405ab92f490c86475f2d4d76 Former-commit-id: c86e7baad3cd7b82f2a9a121c6fdc84ba8fe2e5f
This commit is contained in:
parent
bfc712629c
commit
6f426425c1
|
|
@ -19,24 +19,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import localeMixin from '@/locales/mixin.js'
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
mixins: [
|
||||||
onChangeLocale (command) {
|
localeMixin
|
||||||
this.$i18n.locale = command
|
]
|
||||||
let message = `当前语言:${this.$t('_name')} [ ${this.$i18n.locale} ]`
|
|
||||||
if (['TRAVIS', 'NETLIFY'].includes(process.env.VUE_APP_BUILD_MODE)) {
|
|
||||||
message = [
|
|
||||||
`当前语言:${this.$t('_name')} [ ${this.$i18n.locale} ]`,
|
|
||||||
`仅提供切换功能,没有配置具体的语言数据 `,
|
|
||||||
`文档参考:<a class="el-link el-link--primary is-underline" target="_blank" href="https://doc.d2admin.fairyever.com/zh/sys-locales/">《国际化 | D2Admin》</a>`
|
|
||||||
].join('<br/>')
|
|
||||||
}
|
|
||||||
this.$notify({
|
|
||||||
title: '语言变更',
|
|
||||||
dangerouslyUseHTMLString: true,
|
|
||||||
message
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
onChangeLocale (command) {
|
||||||
|
this.$i18n.locale = command
|
||||||
|
let message = `当前语言:${this.$t('_name')} [ ${this.$i18n.locale} ]`
|
||||||
|
if (['TRAVIS', 'NETLIFY'].includes(process.env.VUE_APP_BUILD_MODE)) {
|
||||||
|
message = [
|
||||||
|
`当前语言:${this.$t('_name')} [ ${this.$i18n.locale} ]`,
|
||||||
|
`仅提供切换功能,没有配置具体的语言数据 `,
|
||||||
|
`文档参考:<a class="el-link el-link--primary is-underline" target="_blank" href="https://doc.d2admin.fairyever.com/zh/sys-locales/">《国际化 | D2Admin》</a>`
|
||||||
|
].join('<br/>')
|
||||||
|
}
|
||||||
|
this.$notify({
|
||||||
|
title: '语言变更',
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
message
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -70,8 +70,6 @@ export default {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
commit('d2admin/gray/set', true, { root: true })
|
commit('d2admin/gray/set', true, { root: true })
|
||||||
MessageBox.confirm('确定要注销当前用户吗', '注销用户', {
|
MessageBox.confirm('确定要注销当前用户吗', '注销用户', {
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
993e8039f53a8c7eceba1fbf441b887545d29a41
|
1233019702184e7285e070b183c86ba6f3fb4be0
|
||||||
Loading…
Reference in New Issue