carefree-fuzzy-query
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

FuzzyQuery 模糊查询

依赖安装

 npm i carefree-fuzzy-query

参数

参数 说明 类型
columns 表格 columns TablesProps['columns']
request 请求 ( params: any) => Promise<{ label: any; value: any; [s: string]: any }[]>
debounceTimeout 延迟时间 number
tipWidth 提示框 宽度 number

更多参数

类型

export interface FuzzyQueryProps extends SelectProps<any> {
  /** 表格标题 */
  columns?: TablesProps['columns'];
  /** 请求 */
  request: (
    params: any,
  ) => Promise<{ label: any; value: any; [s: string]: any }[]>;
  /** 延迟时间 */
  debounceTimeout?: number;
  /** 提示框 宽度 */
  tipWidth?: number;
}

案例

import 'antd/dist/reset.css';
import FuzzyQuery from 'carefree-fuzzy-query';
import React from 'react';

const Query = () => {
  const [value, setValue] = React.useState([]);
  // 根据key模糊查询组织
  const selectLike = async () => {
    return Array.from({ length: 20 }).map((_, index) => {
      return {
        label: `名称---${index}`,
        phone: index,
      };
    });
  };
  return (
    <div>
      <FuzzyQuery
        request={selectLike}
        mode="multiple"
        value={value}
        onChange={setValue}
        placeholder="请选择"
        columns={[
          { dataIndex: 'label', title: '用户名' },
          { dataIndex: 'phone', title: '电话' },
        ]}
        fieldNames={{ value: 'phone' }}
      />
    </div>
  );
};
export default Query;

Readme

Keywords

none

Package Sidebar

Install

npm i carefree-fuzzy-query

Weekly Downloads

1

Version

2.0.3

License

MIT

Unpacked Size

80.1 kB

Total Files

29

Last publish

Collaborators

  • sunluxy