跳转到内容

面板项绘制器脚本

可根据面板数据自定义绘制脚本代码,需返回一段html格式的字符串,绘制面板项时会将返回的字符串以v-html的形式替换掉面板项内容。

参数

名称类型描述
dataIApiData当前业务数据
documentDocument当前文档对象
selector(className: string) => HTMLCollectionOf<Element>元素选择器
envIEnvironment当前环境对象
appSessionIApiData当前应用会话对象
appIApiAppHubController当前应用
util{ message: IApiMessageUtil, notification: IApiNotificationUtil,modal: IApiModalUtil,confirm: IApiConfirmUtil,openView: IApiOpenViewUtil}工具集

调用示例

基于当前数据绘制自定义标题

typescript
`<h1>${data.title}</hl>`

根据数据业务条件绘制面板项内容

使用自执行函数,根据数据中的name判断字体是否红色。

typescript
(function() { 
let style = ''; 
if (data.name === '演示数据1') {
	style = `color:red`
} else {
	style = `color:blue`
}
return `<div style=${style}>名称-数量:${data.name || ''}-${data.quantity || ''}</div>`; 
})()
未来已来,立即拥抱应用融合的力量
Released under the MIT License.