代码规范

This commit is contained in:
q4speed 2020-02-27 17:47:44 +08:00
parent aa44f7973f
commit fb215cd2e6
6 changed files with 33 additions and 16 deletions

View File

@ -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

View File

@ -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;

View File

@ -1,4 +1,4 @@
const zh_CN = {
export default {
commons: {
'workspace': '工作空间',
'organization': '组织',
@ -70,5 +70,3 @@ const zh_CN = {
'home': '首页',
}
};
export default zh_CN

View File

@ -1,4 +1,4 @@
const zh_TW = {
export default {
commons: {
'workspace': '工作空间',
'organization': '组织',
@ -33,5 +33,3 @@ const zh_TW = {
'home': '首页',
}
};
export default zh_TW

View File

@ -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 () {

23
frontend/代码规范.MD Normal file
View File

@ -0,0 +1,23 @@
####文件命名:
- html 小写字母+横线,例如:index.htmlorg-list.html
- js 小写字母+横线,例如:i18n.jsen-US.js
- vue 驼峰命名首字母大写例如Login.vueHeaderUser.vue
####变量命名:
- 常量 大写字母加下划线,例如:const ROLE_ADMIN='admin'
- 变量 驼峰命名首字母小写例如let namelet currentProject
- 方法 驼峰命名首字母小写例如function open(){}function openDialog()
####Vue组件:
- 导出名称 驼峰命名首字母大写以Ms开头例如MsUser
####样式规范:
- 均写入vue文件的<style scope></style>标签内非全局样式必须添加scope
- 修改ElementUI的样式仅在必要情况下写在<style></style>
- 命名 小写字母+横线,例如.menu.header-menu#header-top
####格式要求:
- 遵循.editorconfig
####Vue风格指南:
- https://cn.vuejs.org/v2/style-guide/