简体中文
list.render.after
约 480 字大约 2 分钟
2025-12-16
该钩子在渲染对象表格之后调用,用于在列表渲染后执行额外的动作。
跨对象筛选模式下不会执行该Hook。
参数
functional用于注册Hook回调函数。执行该Hook时,宿主会向回调函数传入以下参数:
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| context | 列表通用参数 | Object | — | — |
| plugin | 当前插件运行信息,业务逻辑通常不需要使用 | Object | — | — |
返回结果
Hook可以返回配置对象,也可以返回Promise<Object>。宿主会在Promise resolve后处理返回的配置。
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| batchtermSlot | 列表筛选区自定义内容挂载函数(示例) | ({wrapper: HTMLDivElement}) => ({destroy: () => void}) | — | — |
batchtermSlot函数入参:
| 参数 | 说明 | 类型 |
|---|---|---|
| wrapper | 宿主提供的列表筛选区DOM挂载容器 | HTMLDivElement |
batchtermSlot必须同步返回包含destroy()方法的对象:
| 参数 | 说明 | 类型 |
|---|---|---|
| destroy | 清理插件创建的DOM和事件;列表重新渲染或销毁时由宿主调用 | () => void |
如果未返回对象或返回对象没有destroy()方法,宿主会抛出错误。
示例
自定义筛选条件
export default class Plugin {
apply() {
return [{
event: "list.render.after",
functional: this.renderAfter.bind(this)
}]
}
async renderAfter(context, plugin) {
return {
// 1.如何在列表增加一个自定义筛选条件
batchtermSlot: ({wrapper}) => this.renderBatchtermSlot({wrapper, context})
}
}
renderBatchtermSlot({wrapper, context}) {
const content = document.createElement('div');
const filterList = () => {
context.bizApi.filter({
conditions: [{
Comparison: 7,
FieldName: 'name',
FilterValue: 'content'
}]
});
};
content.innerHTML = '自定义筛选按钮';
content.addEventListener('click', filterList);
wrapper.appendChild(content);
return {
destroy() {
content.removeEventListener('click', filterList);
content.remove();
}
};
}
}context.bizApi.filter(params)参数:
| 参数 | 说明 | 类型 |
|---|---|---|
| params | 插件筛选参数 | Object |
| params.conditions | 追加到当前列表筛选条件的条件数组 | Object[] |
| conditions[].Comparison | 筛选操作符编号,例如7表示包含 | Number |
| conditions[].FieldName | 筛选字段apiName | String |
| conditions[].FilterValue | 筛选值 | Any |
该方法返回void,调用后触发列表数据重新查询。
效果示意

