update:抽离和合并内容

This commit is contained in:
2024-11-03 03:28:20 +08:00
parent 1327438f89
commit 5e67c93b63
28 changed files with 488 additions and 803 deletions

View File

@@ -13,7 +13,7 @@ export const App = () => {
}}>
<Router>
<Routes>
<Route path='/' element={<Navigate to='/model/' />} />
<Route path='/' element={<Navigate to='/modal/' />} />
<Route path='/modal/*' element={<FlowApps />} />
<Route path='/codemirror/*' element={<CodeMirrorApp />} />
<Route path='/404' element={<div>404</div>} />

View File

@@ -29,7 +29,7 @@ export function createDOMElement(jsxElement: JSX.Element) {
}
const domElement = document.createElement(type);
if (!props) return domElement;
// 处理 props
Object.keys(props).forEach((prop) => {
if (prop === 'children') {

View File

@@ -78,6 +78,7 @@ const ModelTwo = () => {
const ModelTwo2 = () => {
const ref = useRef<HTMLDivElement>(null);
const showModel = () => {
console.log('refHide', refHide);
const div = createDOMElement(refHide);
const model = DialogModal.render(ref.current! || div, {
dialogTitle: 'Dialog Modal',
@@ -101,7 +102,7 @@ const ModelTwo2 = () => {
return (
<div>
<div className='w-96 p-4 rounded-md shadow-md bg-slate-200'>
model two -ref的模块没有真实渲染到节点createDOMElement
model two -ref的模块没有真实渲染到节点 createDOMElement
<div className='cursor-pointer p-2 border' onClick={showModel}>
show
</div>