1.1.0 • Published 4 years ago

@feizheng/react-ant-select v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

react-ant-select

React ant select builder.

version license size download

installation

npm install -S @feizheng/react-ant-select

update

npm update @feizheng/react-ant-select

properties

NameTypeRequiredDefaultDescription
classNamestringfalse-The extended className for component.
valueobjectfalse-Default value.
placeholderstringfalse'请选择'Placeholder.
itemsarrayfalse[]The data source.
templatefuncfalse-The data item template.
onChangefuncfalsenoopThe change handler.

usage

  1. import css

    @import "~@feizheng/react-ant-select/dist/style.scss";
    
    // customize your styles:
    $react-ant-select-options: ()
  2. import js

    import ReactAntSelect from '@feizheng/react-ant-select';
    import ReactDOM from 'react-dom';
    import React from 'react';
    import './assets/style.scss';
    
    class App extends React.Component {
      state = {
        items: [
          {
            value: 'op1',
            label: 'option1d'
          },
          {
            value: 'op2',
            label: 'option2d'
          },
          {
            value: 'op3',
            label: 'option3d'
          }
        ]
      };
    
      handleChange = (inEvent) => {
        console.log('inEvent.target.value', inEvent.target.value);
      };
    
      render() {
        const { items } = this.state;
        return (
          <div className="app-container">
            <ReactAntSelect items={items} onChange={this.handleChange} />
          </div>
        );
      }
    }
    
    ReactDOM.render(<App />, document.getElementById('app'));

documentation

license

Code released under the MIT license.