uiwjs / react-json-view

A React component for displaying and editing javascript arrays and JSON objects.
https://uiwjs.github.io/react-json-view/
MIT License
212 stars 12 forks source link

对于Map这种数据结构,如果Key是一个对象,有办法在预览的时候显示吗? #57

Closed MilesPan closed 2 months ago

MilesPan commented 2 months ago

const map = new Map(); map.set({ name: 1 }, 10); map.set({ name: 2 }, 10); <ReactJson value={{ map, key: 1 }} style={jsonTheme}></ReactJson> 目前预览效果是这样的。 image

期望: 有没有办法实现DevTool中这种预览效果 image

jaywcjlove commented 2 months ago

@MilesPan 样式可以定义出来,但是你可以自己研究一下,参考官方示例

https://github.com/uiwjs/react-json-view/blob/32b34c1b57a73e9cb46022aea406110b89cb79cb/www/src/example/default.tsx#L25-L68

image