1.0.5 • Published 5 years ago

test-react-select v1.0.5

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

test-react-select

npm version Build Status GitHub

:tada: For version >= 2.0.0, please update react and react-dom to at least 16.8.6, since it is rewrited with hooks.

  "peerDependencies": {
    "react": "^16.9.0",
    "react-dom": "^16.9.0"
  }

Docs Link

attributes

attributes

PropsTypeDescriptionDefault
optionsOptarrnone
placeholderOptStrselect...
emptyRecordTextOptStr无匹配数据
isLoadingOptBoolenfalse
customStyleOptObjnone
selectOptObj
widthOptStr160px
heightOptStr30px
optionsOptObj
maxHeightOptStr250px
import React , {useState, useEffect} from 'react';
import TextSelect from 'test-react-select';

function App () {
  const stateTest = useState('1111');
  const optionsHash = [ // 用户options
    { name: "BTC" },
    { name: "ETH" },
    { name: "EOS", disabled: true },
    { name: "BTC2" },
    { name: "ETH3" },
    { name: "EOS4" },
    { name: "BTC5" },
    { name: "ET6H" },
    { name: "EOS1" }
  ];
  const attributes = {
    options: optionsHash,
    placeholder: '请选择',
    emptyRecordText: '无匹配数据111',
    isLoading: true,
    customStyle: {
      select: {
        width: '200px',
        height: '40px',
      },
      options: {
        maxHeight: '200px'
      }
    },
    change: (val) => {
      stateTest[1](val.name);
    }
  };
  const stateAttributes = useState(attributes);

  useEffect(() => {
    setTimeout(() => {
      stateAttributes[1]({...attributes, isLoading: false});
    }, 2000)
  }, []);
  
  return (
    <div>
      <TextSelect attributes={stateAttributes[0]}/>
      <p>{stateTest[0]}</p>
    </div>
  )
}

export default App
1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago