0.0.5 • Published 8 months ago

boolean-ftl v0.0.5

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

boolean-ftl

📦 安装

npm install boolean-ftl --save

# 或者使用 yarn
yarn add boolean-ftl

# 或者使用 cnpm
cnpm install boolean-ftl --save

# 或者使用 pnpm
pnpm install boolean-ftl --save

⚙️ 配置

SearchList 组件支持以下配置项:

  • url(必需):请求数据的 API 地址。
  • searchSchema(必需):搜索表单的配置数组。
  • tableColumns(必需):表格列的配置数组。

🔨 使用

import { SearchList } from 'boolean-ftl';
import { Card } from 'antd';
import { useState, useEffect } from 'react';

const List = () => {
  // 表格列配置
  const tableSchema = [
    {
      title: 'id',
      dataIndex: 'id',
    },
    {
      title: '姓名',
      dataIndex: 'name',
    },
    {
      title: '年龄',
      dataIndex: 'age',
    }
  ];
  // 搜索表单配置
  const searchSchemaArr = [
    {
      label: '输入框',
      type: 'input',
      key: 'input',
    },
    {
      label: '选择框',
      type: 'select',
      key: 'select',
      oplist: [
        {
          name: '选项1',
          value: '1',
        },
        {
          name: '选项2',
          value: '2',
        },
      ],
    },
    {
      label: '时间',
      type: 'rangePicker',
      key: 'rangePicker',
    },
  ];
  return (
    <Card>
      <SearchList
        url="/api/list"
        searchSchema={searchSchemaArr}
        tableColumns={tableSchema}
      />
    </Card>
  );
};
export default List;

API

SearchList Props

属性名类型默认值说明
urlstring (必需)-数据请求的 API 端点 URL
tableColumnsarray (必需)-表格列的定义,包括标题、数据字段等
searchSchemaarray (可选)-搜索表单的配置,用于筛选数据
exportUrlstring (可选)-导出数据的 API 端点 URL
paginationboolean (可选)true是否显示分页器
mergeDataobject (可选)-用于合并数据的配置,包括要合并的列和唯一索引键
useCacheboolean (可选)false是否启用搜索数据的缓存
cacheIdstring (可选)-缓存标识符,用于唯一标识缓存数据
pageSizeKeystring (可选)'limit'列表每页数量的键名
pageKeystring (可选)'page'列表页码的键名
getTableDatafunction (可选)-用于获取列表数据的回调函数