mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
docs: update demo template (#35440)
This commit is contained in:
parent
be982e164a
commit
c897728eb8
@ -223,8 +223,10 @@ class Demo extends React.Component {
|
||||
'const { $1 } = ReactRouterDOM;',
|
||||
)
|
||||
.replace(/([A-Za-z]*)\s+as\s+([A-Za-z]*)/, '$1:$2')
|
||||
.replace(/export default/, 'const Demo =')}\n\n${
|
||||
react18 ? 'createRoot(mountNode).render(<Demo />)' : 'ReactDOM.render(<Demo />, mountNode)'
|
||||
.replace(/export default/, 'const ComponentDemo =')}\n\n${
|
||||
react18
|
||||
? 'createRoot(mountNode).render(<ComponentDemo />)'
|
||||
: 'ReactDOM.render(<ComponentDemo />, mountNode)'
|
||||
};\n`,
|
||||
css: prefillStyle,
|
||||
editors: '001',
|
||||
@ -253,8 +255,10 @@ class Demo extends React.Component {
|
||||
react18
|
||||
? `import React from 'react';\nimport { createRoot } from 'react-dom/client';\n`
|
||||
: ''
|
||||
}${sourceCode.replace(/export default/, 'const Demo =')}\n\n${
|
||||
react18 ? 'createRoot(mountNode).render(<Demo />)' : 'ReactDOM.render(<Demo />, mountNode)'
|
||||
}${sourceCode.replace(/export default/, 'const ComponentDemo =')}\n\n${
|
||||
react18
|
||||
? 'createRoot(mountNode).render(<ComponentDemo />)'
|
||||
: 'ReactDOM.render(<ComponentDemo />, mountNode)'
|
||||
};\n`,
|
||||
css: prefillStyle,
|
||||
json: JSON.stringify(
|
||||
|
Loading…
Reference in New Issue
Block a user