Quellcode durchsuchen

fix: parse 错误

ZhaoJun vor 1 Jahr
Ursprung
Commit
63b1eeeb94
1 geänderte Dateien mit 3 neuen und 2 gelöschten Zeilen
  1. 3 2
      src/components/DDComponents/DIYTable/index.tsx

+ 3 - 2
src/components/DDComponents/DIYTable/index.tsx

@@ -212,7 +212,8 @@ function DIYTable(props: IProps) {
       for (let index = 0; index < rows.length; index++) {
         // 把每一行的数据提出来到一个对象里
         if (rows) {
-          const row = rows[index];
+          const row = typeof rows[index] === 'string' ? JSON.parse(rows[index]) : rows[index];
+
           if (index === 0) {
             // 列配置
             row.forEach((col: any) => {
@@ -250,7 +251,7 @@ function DIYTable(props: IProps) {
       if (displayOnly) {
         for (let index = 0; index < rows.length; index++) {
           // 把每一行的数据提出来到一个对象里
-          const row = rows[index];
+          const row = typeof rows[index] === 'string' ? JSON.parse(rows[index]) : rows[index];
           const rowData: any = {};
           if (displayOnly) {
             row.forEach((col: any) => {