跳转到内容

面板绘制器脚本

可根据面板数据自定义绘制脚本代码,需返回一段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>`

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

根据数据中的starttime判断是否超时。

typescript
let str = data.starttime;
let num = Number(str);
const start = new Date(data.starttime);
const overTime = Date.now() - start.getTime() - 60000;
if (overTime > 0) {
    return `<span>已超时 ${overTime/1000} s</span>`
} else {
    return  "";
}
未来已来,立即拥抱应用融合的力量
Released under the MIT License.