From 5944c2832820a8bfa86e3efb5085f5a2463897f9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 22 九月 2020 09:14:49 +0800 Subject: [PATCH] 2020-09-22 --- src/menu/datasource/index.jsx | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx index 28735f2..6e4bdeb 100644 --- a/src/menu/datasource/index.jsx +++ b/src/menu/datasource/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' +import {connect} from 'react-redux' import { is, fromJS } from 'immutable' import { Icon, Modal } from 'antd' @@ -11,7 +12,6 @@ class DataSource extends Component { static propTpyes = { config: PropTypes.any, - menu: PropTypes.object, updateConfig: PropTypes.func } @@ -27,10 +27,11 @@ const { config } = this.props this.setState({setting: fromJS(config.setting).toJS()}) + this.props.updateConfig(config) // 瑙﹀彂鑿滃崟淇℃伅鏇存柊 } shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + return !is(fromJS(this.state), fromJS(nextState)) } editDataSource = () => { @@ -84,4 +85,14 @@ } } -export default DataSource \ No newline at end of file +const mapStateToProps = (state) => { + return { + menu: state.customMenu + } +} + +const mapDispatchToProps = () => { + return {} +} + +export default connect(mapStateToProps, mapDispatchToProps)(DataSource) \ No newline at end of file -- Gitblit v1.8.0