Ant Design Vue Pro 隐藏多语言切换,并设置默认中文

Posted by xtong on September 26, 2021

隐藏切换语言按钮

  • src/components/GlobalHeader/RightContent.vue
1
2
3
4
5
6
<template>
  <div :class="wrpCls">
    <avatar-dropdown :menu="showMenu" :current-user="currentUser" :class="prefixCls" />
    <!-- 隐藏语言选择 <select-lang :class="prefixCls" />-->
  </div>
</template>
  • src/layouts/UserLayout.vue
1
2
3
4
5
6
7
8
9
<template>

  <div id="userLayout" :class="['user-layout-wrapper', isMobile && 'mobile']">
    <div class="container">
      <div class="user-layout-lang">
      <!-- 隐藏语言选择 <select-lang class="select-lang-trigger" />-->
      </div>
...

设置默认中文

  • src/store/modules/app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
const app = {
  state: {
    sideCollapsed: false,
    isMobile: false,
    theme: 'dark',
    layout: '',
    contentWidth: '',
    fixedHeader: false,
    fixedSidebar: false,
    autoHideHeader: false,
    color: '',
    weak: false,
    multiTab: true,
    lang: 'zh-CN', // 默认中文
    _antLocale: {}
  },
...
  • src/core/bootstrap.js
1
2
3
4
...
  store.dispatch('setLang', storage.get(APP_LANGUAGE, 'zh-CN')) // 默认中文
  // last step
}

软件版本:vue-antd-pro 3.0.2

  • “ant-design-vue”: “^1.7.6”
  • “vue”: “^2.6.0”,