fix: 修复新版react-router 启动报错

This commit is contained in:
liaoxuezhi 2024-05-22 15:01:35 +08:00
parent bbb1d64c35
commit 9c28e2e842
2 changed files with 355 additions and 361 deletions

View File

@ -141,8 +141,7 @@ class BackTop extends React.PureComponent {
); );
} }
} }
// @ts-ignore
@withRouter // @ts-ignore
export class App extends React.PureComponent<{ export class App extends React.PureComponent<{
location: Location; location: Location;
}> { }> {
@ -864,7 +863,6 @@ export function navigations2route(
export default function entry() { export default function entry() {
// PathPrefix = pathPrefix || DocPathPrefix; // PathPrefix = pathPrefix || DocPathPrefix;
return ( return (
<Router> <Router>
<Switch> <Switch>

View File

@ -31,8 +31,7 @@ export default function (schema, schemaProps, showCode, envOverrides) {
}; };
} }
return withRouter( return class extends React.Component {
class extends React.Component {
static displayName = 'SchemaRenderer'; static displayName = 'SchemaRenderer';
iframeRef; iframeRef;
state = {open: false, schema: {}}; state = {open: false, schema: {}};
@ -396,9 +395,7 @@ export default function (schema, schemaProps, showCode, envOverrides) {
// <i className="fa fa-copy p-l-xs"></i> // <i className="fa fa-copy p-l-xs"></i>
// </div> // </div>
// </div> // </div>
<Portal <Portal container={() => document.getElementById('Header-toolbar')}>
container={() => document.getElementById('Header-toolbar')}
>
<div className="hidden-xs hidden-sm ml-3"> <div className="hidden-xs hidden-sm ml-3">
<div> <div>
<div className="Doc-headingList"> <div className="Doc-headingList">
@ -420,6 +417,5 @@ export default function (schema, schemaProps, showCode, envOverrides) {
</> </>
); );
} }
} };
);
} }