diff --git a/snowy-admin-web/src/components/XnPageSelect/README.assets/分页下拉查询展示.gif b/snowy-admin-web/src/components/XnPageSelect/README.assets/分页下拉查询展示.gif new file mode 100644 index 00000000..be201025 Binary files /dev/null and b/snowy-admin-web/src/components/XnPageSelect/README.assets/分页下拉查询展示.gif differ diff --git a/snowy-admin-web/src/components/XnPageSelect/README.md b/snowy-admin-web/src/components/XnPageSelect/README.md new file mode 100644 index 00000000..7c45cf2d --- /dev/null +++ b/snowy-admin-web/src/components/XnPageSelect/README.md @@ -0,0 +1,192 @@ +XnPageSelect 分页下拉选择器 +==== + + +封装说明 +---- + +> 基础的使用方式与 API 与 [官方版(Select)](https://www.antdv.com/components/select-cn/) 本一致,在其基础上,封装了加载数据的方法。(调用后端分页接口,懒加载的效果查询下拉数据) +> +> @zhanggengbi在此基础上完善了功能:下拉查询同时支持搜索框搜索--调用后端数据搜索。 + +例子1 +---- +(基础使用) + +```vue + + + + +``` + + + +例子2 +---- + +(支持搜索框搜索--调用后端数据搜索) + +```vue + + + +``` + +![分页下拉查询展示](.\README.assets\分页下拉查询展示.gif) + +内置方法 +---- + + +| 方法 | 说明 | 参数类型 | 参数示例 | +| ------ | ------------ | -------- | ------------ | +| onPage | 请求分页数据 | Object | {current: 1} | + + +内置属性 +---- +> 除去 `a-select` 自带属性外,还而外提供了一些额外属性属性 + + +| 属性 | 说明 | 类型 | 默认值 | +| ------------- | ------------------------------------------- | ------- | ------ | +| pageFunction | 分页函数 必须为 `Promise` 对象 **必须绑定** | Promise | - | +| pageSize | 分页条数 | Number | 10 | +| showSearch | 配置是否可搜索 | Boolean | false | +| searchKeyName | 搜索字段属性名 | String | '' | + +注意事项 +---- + +> 分页函数,返回的Promise对象的data数据是分页格式的数据 +> +> data.records格式如下:{ name: name, id: id } id最后是你的value,name是你的显示名称 + +如果返回的数据data.records格式命名不对,可以重新封装一下 + +```javascript +// 示例重新封装一下data.records +const selectApiFunction = { + customerSelector: (param) => { + return customerInfoApi.customerPage(Object.assign(param, {envFlag: searchFormState.value.envFlag})).then((data) => { + if (data.records){ + data.records = data.records.map((item) => { + return { + name: item.customerName, + id: item.customerInfoId, + }; + }); + } + return Promise.resolve(data) + }) + } +} +``` +更新时间 +---- + +该文档最后更新于: 2024-06-28 PM 16:45