fix: schema should be componentsTree

This commit is contained in:
wuji.xwt 2020-07-28 14:21:27 +08:00
parent 9035a8554c
commit 69a2a8998f

View File

@ -8,7 +8,7 @@ import './index.scss';
const SamplePreview = ({ editor }: PluginProps) => {
const [data, setData] = useState({});
const [visible, setVisible] = useState(false);
const handleClick = async () => {
async function handleClick() {
if (!editor) {
return;
}
@ -25,6 +25,10 @@ const SamplePreview = ({ editor }: PluginProps) => {
}
};
function handleClose() {
setVisible(false);
}
const { schema, components } = data;
return (
<div className="lowcode-plugin-sample-preview">
@ -34,11 +38,12 @@ const SamplePreview = ({ editor }: PluginProps) => {
<Dialog
visible={visible}
footer={false}
onClose={handleClose}
>
<ReactRenderer
schema={schema}
{visible && <ReactRenderer
schema={schema.componentsTree[0]}
components={components}
/>
/>}
</Dialog>
</div>
);