瀏覽代碼

修复表格导出字段中存在空数组时导出异常问题

jqh 4 年之前
父節點
當前提交
af41187c0b
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/Grid/Exporters/AbstractExporter.php

+ 6 - 0
src/Grid/Exporters/AbstractExporter.php

@@ -230,6 +230,12 @@ abstract class AbstractExporter implements ExporterInterface
     {
         foreach ($data as &$row) {
             $row = Arr::dot($row);
+
+            foreach ($row as &$v) {
+                if (is_array($v) || is_object($v)) {
+                    $v = json_encode($v, JSON_UNESCAPED_UNICODE);
+                }
+            }
         }
 
         return $data;