简体中文
list.previewImage.before
约 187 字小于 1 分钟
2025-12-16
该钩子在列表图片字段预览前调用(不支持列表通用参数)。 预览图片前执行额外的业务逻辑:
- 使用其他方式进行预览
参数
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| objectApiname | 对象apiName | string | — | — |
| fieldName | 字段apiName | string | — | — |
| data | 字段值 | object[] | — | — |
| trData | 当前行数据 | object | — | — |
| startIndex | 点击图片是第几个(index) | number | — | — |
| field | 字段描述 | object | — | — |
返回结果
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| stopPreView | 是否阻止预览(示例) | boolean | — | — |
基础示例
基础用法
export default class Plugin {
apply() {
return [{
event: "list.previewImage.before",
functional: this.previewBefore.bind(this)
}];
}
previewBefore(context, plugin) {
console.log(context.fieldName);
console.log(context.data);
}
}阻止预览
export default class Plugin {
apply() {
return [{
event: "list.previewImage.before",
functional: this.previewBefore.bind(this)
}];
}
previewBefore(context, plugin) {
return Promise.resolve({
stopPreView: true
})
}
}