Commit b796ce39 by zhaochengxiang

乾坤传参问题

parent 66dc4260
......@@ -31,20 +31,23 @@ const AssetTree = loadable(()=> import('./view/Manage/AssetManage/Component/Asse
export class App extends React.Component {
constructor() {
super();
this.$$hostParams = null;
this.state = {
hostParams: this.params
hostParams: null
};
}
componentDidMount() {
this.setState({ hostParams: this.props?.data });
this.$$hostParams = $hostParams.subscribe(() => {
if ($hostParams.getValue()) {
this.setState({ hostParams: $hostParams.getValue() });
}
})
}
componentWillUnmount() {
this.$$hostParams?.unsubscribe()
this.$$hostParams?.unsubscribe();
}
render() {
......
......@@ -14,6 +14,7 @@ import { $hostParams } from "./util";
function render(props) {
const { container, ...restProps } = props;
ReactDOM.render(
//解决主次应用样式冲突
//https://qiankun.umijs.org/faq#how-to-guarantee-the-main-app-stylesheet-isolated-with-sub-apps
......@@ -55,5 +56,5 @@ export async function unmount(props) {
}
export async function update(props) {
$hostParams.next(props);
$hostParams.next(props?.data);
}
\ No newline at end of file
......@@ -17,7 +17,7 @@ export const inputWidth = isSzseEnv?360:240;
export const ContextPath = '/data-govern';
export const $hostParams = new BehaviorSubject({});
export const $hostParams = new BehaviorSubject(null);
const routeMap = {};
export const ConvertToRouteMap = function (routes, pPath, pRoute) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment