lrf 2 năm trước cách đây
mục cha
commit
6b40975bf6
1 tập tin đã thay đổi với 10 bổ sung7 xóa
  1. 10 7
      app/public/table-template.js

+ 10 - 7
app/public/table-template.js

@@ -14,14 +14,17 @@ module.exports = (data) => {
     const { title, type, required = false, remark, index, def, zh, ref, getProp } = columns[i];
     let refStr;
     if (ref) {
-      const propList = getProp.split(';');
-      let propStr = '[';
-      for (const p of propList) {
-        if (p !== _.head(propList)) propStr = `${propStr}, `;
-        propStr = `${propStr}'${p}'`;
+      refStr = ` ref: '${_.capitalize(ref)}'`;
+      if (getProp) {
+        const propList = getProp.split(';');
+        let propStr = '[';
+        for (const p of propList) {
+          if (p !== _.head(propList)) propStr = `${propStr}, `;
+          propStr = `${propStr}'${p}'`;
+        }
+        propStr += ']';
+        refStr = `, getProp: ${propStr}`;
       }
-      propStr += ']';
-      refStr = `ref: '${_.capitalize(ref)}', getProp: ${propStr}`;
     }
     const str = `  ${title}: { type: ${type || 'String'}, required: ${required} ${type === 'Secret' ? ', select: false' : ''} ${def ? `, default: '${def}'` : ''}${
       zh ? `, zh: '${zh}'` : ''