美文网首页
2018-03-15 react-select

2018-03-15 react-select

作者: NOTEBOOK2 | 来源:发表于2018-03-16 11:37 被阅读0次
disassembly.png 屏幕快照 2018-03-14 19.01.28.png
              <div className="w-50">
                <InputSelectBox title="PRODUCTION ORDER TYPE"
                                value={typeId}
                                disabled = { !editMode }
                                resetValue={  undefined  }
                                clearable={  false  }
                                onChange={ (e) => actions.changeOrderType(e.value) }
                                options={  options  }/>
              </div>
export const changeOrderType = (value) => ({
  type: actionTypes.CHANGE_PRODUCTION_ORDER_TYPE,
  value
});   
  [actionTypes.CHANGE_PRODUCTION_ORDER_TYPE]: (state, action) => {
    return { ...state, typeId: action.value };
  },   

Library react-select
https://github.com/JedWatson/react-select

import PropTypes from 'prop-types';
import React, { Component } from 'react';
import Select from 'react-select';


import '../input-box/input-box.scss';
import './input-select-box.scss';

export default class InputSelectBox extends Component {
  static propTypes = {
    title: PropTypes.string,
    containerClass: PropTypes.string
  };

  static defaultProps = {
    onChange: () => {},
    containerClass: ''
  };

  render() {
    const { title, containerClass } = this.props;

    return (
      <div className={ `input-box ${containerClass}` }>
        { (title != false) && <p className="input-box__title">{ title }</p> }
        <Select { ...this.props }/>
      </div>
    );
  }
}   

相关文章

网友评论

      本文标题:2018-03-15 react-select

      本文链接:https://www.haomeiwen.com/subject/bsplqftx.html