0.0.2 • Published 6 years ago

selectx v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

selectx

基于 Antd Select 组件封装,可使表单组件变成 Modal Form Component, XSelect 所有的属性同原Antd Select 属性。

📦 安装

yarn add selectx 
or
npm install selectx --save

🔨 示例

import XSelect from 'selectx';

// 默认
<XSelect
  remoteUrl="/remote/data/url?page=1&size=10&searchKeyword="
/>

// 自定义选项展示
<XSelect
  showSearch
  popContainer="developerFormWrap"
  customLabelField="realNameCn"
  customeValueField="empId"
  placeholder="搜索开发人员"
  remoteUrl="/api/user?size=30&w="
  style={{ width: '100%' }}
>
  {o => (<Option key={o.value} value={o.value}>{`${o.text}(${o.value})`}</Option>)}
</XSelect>

✨ API

参数说明类型默认值
remoteUrl获取远程数据的url地址(需自行解决跨域问题)String-
value指定当前选中的条目string|string[]|number|number[]undefined
customLabelField自定义label取值的字段名称Booleanname
customeValueField自定义value取值的字段名称Booleanid
recommend自定义默认选项值,为对象数组,其中的对象key定义为:text、valueArray[]
onChange选中 option,或 input 的 value 变化时,调用此函数function(value)-
children自定义选项值展示function(optionObject)-