2.0.3 • Published 10 months ago

carefree-fuzzy-query v2.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

FuzzyQuery 模糊查询

依赖安装

 npm i carefree-fuzzy-query

参数

参数说明类型
columns表格 columnsTablesProps['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;
2.0.3

10 months ago

1.0.50

1 year ago

1.0.49

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.48

2 years ago

1.0.47

2 years ago

1.0.46

2 years ago

1.0.44

2 years ago

1.0.43

2 years ago

1.0.45

2 years ago

1.0.42

2 years ago

1.0.41

2 years ago

1.0.40

2 years ago

1.0.39

2 years ago

1.0.38

2 years ago