You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-3Lines changed: 18 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,10 @@
1
-
React Component Example
1
+
React Code Preview
2
2
---
3
3
4
+
Code editor for React. Preview Demo: https://uiwjs.github.io/react-code-preview
5
+
6
+
There are often a lot of sample code in the documentation. We hope that you can run the sample code to view the rendering interface as you read the document.
7
+
4
8
## Install
5
9
6
10
```bash
@@ -14,19 +18,30 @@ import React from 'react';
14
18
import { Button } from'uiw';
15
19
importCodePreviewfrom'@uiw/react-code-preview';
16
20
21
+
constcode=`import { Button, Divider, Icon } from 'uiw';
22
+
ReactDOM.render(
23
+
<div>
24
+
<Button type="primary">主要按钮</Button>
25
+
</div>,
26
+
_mount_
27
+
);
28
+
`;
29
+
17
30
classDemoextendsReact.Component {
18
31
render() {
19
32
return (
20
33
<CodePreview
21
-
code="const a = 0;"
34
+
code={code}
22
35
dependencies={{ Button }}
23
36
/>
24
37
);
25
38
}
26
39
}
27
40
```
28
41
29
-
### Properties
42
+
-`_mount_` Special strings, the compilation will be replaced.
0 commit comments