Przeglądaj źródła

fix: resolve JsonViewer type error (#2748)

Co-authored-by: 田丰 <[email protected]>
田丰 7 miesięcy temu
rodzic
commit
0563052c1c

+ 2 - 2
content/plus/jsonviewer/index.md

@@ -155,8 +155,8 @@ render(FormatJsonComponent);
 | 属性                | 说明                                             | 类型                              | 默认值    |
 |-------------------|------------------------------------------------|---------------------------------|--------------|
 | value             | 展示内容                                    | string                                  | -  |
-| height            | 高度                                     | number                                  | -  |
-| width             | 宽度                                     | number                                  | -  |
+| height            | 高度                                     | number \| string                                  | -  |
+| width             | 宽度                                     | number \| string                                 | -  |
 | className         | 类名                           | string                                  | -   |
 | style             | 内联样式                           | object                                  | -   |
 | showSearch        | 是否显示搜索Icon                           | boolean                                  | true   |

+ 2 - 2
packages/semi-ui/jsonViewer/index.tsx

@@ -26,8 +26,8 @@ const prefixCls = cssClasses.PREFIX;
 export type { JsonViewerOptions };
 export interface JsonViewerProps extends BaseProps {
     value: string;
-    width: number;
-    height: number;
+    width: number | string;
+    height: number | string;
     showSearch?: boolean;
     className?: string;
     style?: React.CSSProperties;