feat: change to center and clean code
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Container, RenderData } from '@kevisual/container';
|
||||
import { Container, RenderData, ContainerOne } from '@kevisual/container';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { replace, useParams } from 'react-router';
|
||||
import { query, ws, useStore } from '@/modules';
|
||||
@@ -55,7 +55,6 @@ export const Preview = () => {
|
||||
const id = params.id;
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
const containerRef = useRef<Container | null>(null);
|
||||
const [data, setData] = useState<any>({});
|
||||
|
||||
useEffect(() => {
|
||||
if (!id) return;
|
||||
@@ -107,16 +106,15 @@ export const Preview = () => {
|
||||
});
|
||||
console.log('update---data', data, container.data);
|
||||
container.destroy(id!);
|
||||
container.renderId(id!);
|
||||
container.render(id!);
|
||||
return;
|
||||
}
|
||||
console.log('data', containerRef.current);
|
||||
const container = new Container({
|
||||
root: ref.current!,
|
||||
data: data as any,
|
||||
showChild: false,
|
||||
});
|
||||
container.renderId(id!);
|
||||
container.render(id!);
|
||||
containerRef.current = container;
|
||||
};
|
||||
return <div className='mx-auto border bg-gray-200 h-full w-full' ref={ref}></div>;
|
||||
@@ -176,16 +174,15 @@ export const PreviewWrapper = () => {
|
||||
});
|
||||
console.log('update---data', data, container.data);
|
||||
container.destroy(id!);
|
||||
container.renderId(id!);
|
||||
container.render(id!);
|
||||
return;
|
||||
}
|
||||
console.log('data', containerRef.current);
|
||||
const container = new Container({
|
||||
root: ref.current!,
|
||||
data: data as any,
|
||||
showChild: false,
|
||||
});
|
||||
container.renderId(id!);
|
||||
container.render(id!);
|
||||
containerRef.current = container;
|
||||
};
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user