简体中文
getData
约 209 字小于 1 分钟
2025-09-22
该方法同步返回当前详情对象的数据,取自详情页接口返回的 data 字段值。

参数
无
返回结果
仅列举部分字段数据
| 字段 | 说明 | 类型 |
|---|---|---|
| object_describe_api_name | 对象apiName | String |
| display_name | 对象的名称 | String |
| name | 预设业务类型主属性 | String |
| _id | 对象数据的id,新建的数据_id为空 | String |
| 其他字段 | — | — |
代码示例
插件内:
module.exports = function (context, pluginService, pluginParam) {
return {
apply() {
return [
{
event: 'detail.render.before',
functional: function (pluginExecResult, options) {
console.log('custom plugin: detail.render.before exec')
// 获取渲染当前详情对象的数据
console.log(context.getData())
}
}
]
}
}
}注意
该方法得到的数据是经过
util.cloneDeep()处理过的数据,对它进行直接修改不会作用于原始数据。let data = context.getData() data.abc = '123' console.log(context.getData().abc) // 不会影响原始数据
