diff --git a/frontend/src/i18n/en_US.js b/frontend/src/i18n/en-US.js similarity index 98% rename from frontend/src/i18n/en_US.js rename to frontend/src/i18n/en-US.js index 752720e122..63e3c86bcb 100644 --- a/frontend/src/i18n/en_US.js +++ b/frontend/src/i18n/en-US.js @@ -1,4 +1,4 @@ -const en_US = { +export default { commons: { 'workspace': 'Workspace', 'organization': 'Organization', @@ -70,5 +70,3 @@ const en_US = { 'home': 'Home', } }; - -export default en_US diff --git a/frontend/src/i18n/i18n.js b/frontend/src/i18n/i18n.js index 10279b4bfb..35bc7921fe 100644 --- a/frontend/src/i18n/i18n.js +++ b/frontend/src/i18n/i18n.js @@ -4,29 +4,29 @@ import axios from "axios"; import enLocale from "element-ui/lib/locale/lang/en"; import zh_CNLocale from "element-ui/lib/locale/lang/zh-CN"; import zh_TWLocale from "element-ui/lib/locale/lang/zh-TW"; -import zh_CN from "./zh_CN"; +import zh_CN from "./zh-CN"; Vue.use(VueI18n); const messages = { - 'en_US': { + 'en-US': { ...enLocale }, - 'zh_CN': { + 'zh-CN': { ...zh_CN, ...zh_CNLocale }, - 'zh_TW': { + 'zh-TW': { ...zh_TWLocale } }; const i18n = new VueI18n({ - locale: 'zh_CN', + locale: 'zh-CN', messages, }); -const loadedLanguages = ['zh_CN']; +const loadedLanguages = ['zh-CN']; function setI18nLanguage(lang) { i18n.locale = lang; diff --git a/frontend/src/i18n/zh_CN.js b/frontend/src/i18n/zh-CN.js similarity index 98% rename from frontend/src/i18n/zh_CN.js rename to frontend/src/i18n/zh-CN.js index f2df6899e5..3fba6de5b7 100644 --- a/frontend/src/i18n/zh_CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -1,4 +1,4 @@ -const zh_CN = { +export default { commons: { 'workspace': '工作空间', 'organization': '组织', @@ -70,5 +70,3 @@ const zh_CN = { 'home': '首页', } }; - -export default zh_CN diff --git a/frontend/src/i18n/zh_TW.js b/frontend/src/i18n/zh-TW.js similarity index 95% rename from frontend/src/i18n/zh_TW.js rename to frontend/src/i18n/zh-TW.js index 35e88623e5..143343310d 100644 --- a/frontend/src/i18n/zh_TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -1,4 +1,4 @@ -const zh_TW = { +export default { commons: { 'workspace': '工作空间', 'organization': '组织', @@ -33,5 +33,3 @@ const zh_TW = { 'home': '首页', } }; - -export default zh_TW diff --git a/frontend/src/performance/components/HeaderUser.vue b/frontend/src/performance/components/HeaderUser.vue index d145cdaa34..be7b59075c 100644 --- a/frontend/src/performance/components/HeaderUser.vue +++ b/frontend/src/performance/components/HeaderUser.vue @@ -77,7 +77,7 @@ handleCommand(command) { switch (command) { case "personal": - this.$setLang("en_US"); + this.$setLang("en-US"); break; case "logout": this.$get("/signout", function () { diff --git a/frontend/代码规范.MD b/frontend/代码规范.MD new file mode 100644 index 0000000000..1d8ee7badb --- /dev/null +++ b/frontend/代码规范.MD @@ -0,0 +1,23 @@ +####文件命名: +- html 小写字母+横线,例如:index.html,org-list.html +- js 小写字母+横线,例如:i18n.js,en-US.js +- vue 驼峰命名,首字母大写,例如Login.vue,HeaderUser.vue + +####变量命名: +- 常量 大写字母加下划线,例如:const ROLE_ADMIN='admin' +- 变量 驼峰命名,首字母小写,例如let name,let currentProject +- 方法 驼峰命名,首字母小写,例如function open(){},function openDialog() + +####Vue组件: +- 导出名称 驼峰命名,首字母大写,以Ms开头,例如MsUser + +####样式规范: +- 均写入vue文件的标签内,非全局样式必须添加scope +- 修改ElementUI的样式,仅在必要情况下写在 +- 命名 小写字母+横线,例如.menu,.header-menu,#header-top + +####格式要求: +- 遵循.editorconfig + +####Vue风格指南: +- https://cn.vuejs.org/v2/style-guide/