Commit c0740b39 by zhaochengxiang

观察修改

parent e59ad734
...@@ -39,11 +39,15 @@ export class App extends React.Component { ...@@ -39,11 +39,15 @@ export class App extends React.Component {
componentDidMount() { componentDidMount() {
this.setState({ hostParams: this.props?.data }); this.setState({ hostParams: this.props?.data });
this.$$hostParams = $hostParams.subscribe(() => {
if ($hostParams.getValue()) { this.$$hostParams = $hostParams.subscribe({
this.setState({ hostParams: $hostParams.getValue() }); next: (v) => {
} if (v) {
}) this.setState({ hostParams: v });
}
},
});
} }
componentWillUnmount() { componentWillUnmount() {
......
...@@ -2,7 +2,7 @@ import React from "react"; ...@@ -2,7 +2,7 @@ import React from "react";
import { message, notification, Modal, Space, Button } from 'antd'; import { message, notification, Modal, Space, Button } from 'antd';
import { Redirect } from 'react-router-dom'; import { Redirect } from 'react-router-dom';
import { ExclamationCircleOutlined } from '@ant-design/icons'; import { ExclamationCircleOutlined } from '@ant-design/icons';
import { BehaviorSubject } from 'rxjs'; import { Subject } from 'rxjs';
import { dispatchLatest, action } from '../model'; import { dispatchLatest, action } from '../model';
import { set_sess_state } from "../model/reducer"; import { set_sess_state } from "../model/reducer";
...@@ -17,7 +17,7 @@ export const inputWidth = isSzseEnv?360:240; ...@@ -17,7 +17,7 @@ export const inputWidth = isSzseEnv?360:240;
export const ContextPath = '/data-govern'; export const ContextPath = '/data-govern';
export const $hostParams = new BehaviorSubject(null); export const $hostParams = new Subject();
const routeMap = {}; const routeMap = {};
export const ConvertToRouteMap = function (routes, pPath, pRoute) { 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