code refactor

This commit is contained in:
MaysWind
2020-12-22 00:14:21 +08:00
parent acf3241b2b
commit b3e0399300
5 changed files with 41 additions and 13 deletions
+15
View File
@@ -0,0 +1,15 @@
export default function ({i18n}, value, fieldName, translate) {
let content = '';
if (fieldName) {
content = value[fieldName];
} else {
content = value;
}
if (translate) {
content = i18n.t(content);
}
return content;
}