提交 19996b0b authored 作者: vipcxj's avatar vipcxj

fix: DsTable无限刷新自身

上级 0c4d1633
...@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; ...@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { Divider } from 'antd'; import { Divider } from 'antd';
import modelCreator from './model'; import modelCreator from './model';
import connect from '../../hoc/stateful'; import connect from '../../hoc/stateful';
import TableEx from '../../../components/table/index'; import TableEx from '../index';
import { push } from '../../../services/route'; import { push } from '../../../services/route';
import { shallowEqual, arrayJoin } from '../../../utils/helper'; import { shallowEqual, arrayJoin } from '../../../utils/helper';
import styles from './index.less'; import styles from './index.less';
...@@ -30,7 +30,11 @@ const renderButton = (meta) => { ...@@ -30,7 +30,11 @@ const renderButton = (meta) => {
}; };
// noinspection JSUnresolvedVariable // noinspection JSUnresolvedVariable
return ( return (
<a onClick={onClick} onKeyDown={onKeyDown}> {meta.buttonName || 'link'} </a> <a onClick={onClick} onKeyDown={onKeyDown}>
{' '}
{meta.buttonName || 'link'}
{' '}
</a>
); );
} }
throw new Error(`Unsupported button meta: ${JSON.stringify(meta)}.`); throw new Error(`Unsupported button meta: ${JSON.stringify(meta)}.`);
...@@ -45,7 +49,7 @@ class DsTable extends React.Component { ...@@ -45,7 +49,7 @@ class DsTable extends React.Component {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const { coordinate, params, current, start, end } = nextProps; const { coordinate, params, current, start, end } = nextProps;
const { dispatchLocal } = this.props; const { dispatchLocal } = this.props;
if (!shallowEqual(coordinate, this.props.coordinate) || !shallowEqual(params, this.props.params || current !== this.props.current)) { if (!shallowEqual(coordinate, this.props.coordinate) || !shallowEqual(params, this.props.params) || current !== this.props.current) {
dispatchLocal({ type: 'doInit', payload: { coordinate, params, current, start, end } }); dispatchLocal({ type: 'doInit', payload: { coordinate, params, current, start, end } });
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论