Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Commit

Permalink
refactor: module locales infomation
Browse files Browse the repository at this point in the history
  • Loading branch information
Crazyokd committed Apr 15, 2023
1 parent 3cef0d6 commit bf8ba58
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/ToolBar/ToolBarBottom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
简体中文<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command = "zh-CN">简体中文</el-dropdown-item>
<el-dropdown-item command = "en-US">English</el-dropdown-item>
<el-dropdown-item v-for="(locale, index) in locales" :key="index" :command="locale.code">
{{ locale.name }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
Expand Down Expand Up @@ -176,6 +177,7 @@

<script>
import { API_BASE_URL, FILE_UPLOAD_API_URL } from "@/config/api";
import locales from "@/locales";
export default {
name: "ToolBarBottom",
data() {
Expand All @@ -192,6 +194,7 @@ export default {
loading: false,
timer: null,
user: JSON.parse(window.sessionStorage.getItem("user")),
locales,
};
},
computed: {
Expand Down
11 changes: 11 additions & 0 deletions src/locales/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default {
"zh-CN": {
name: "简体中文",
code: "zh-CN",
},
"en-US": {
name: "English",
code: "en-US",
},
// 添加其他语言选项
};

0 comments on commit bf8ba58

Please sign in to comment.