update:抽离和合并内容
This commit is contained in:
@@ -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>} />
|
||||
|
||||
@@ -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') {
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user