DictionaryValueText.js 576 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
import React, { PureComponent } from 'react';
import { connect } from 'dva';

@connect(({ dictionarySelect, loading }) => ({
  data: dictionarySelect,
  loading: loading.models.dictionarySelect,
}))
class DictionaryValueText extends PureComponent {
  componentDidMount() {
    const { dataKey, dispatch } = this.props;
    dispatch({
      type: 'dictionarySelect/queryText',
      payload: {
        dataKey,
        value: 1,
      },
    });
  }

  render() {
    const { data } = this.props;
    return <span>{data.text}</span>;
  }
}

export default DictionaryValueText;