在预览模式下仪表盘菜单初始化事件
仪表盘接口对象
仪表盘菜单接口对象
示例代码
onFlexMenuInit (iDashboard, iFlexMenu) {
console.log('dashboard.onFlexMenuInit: ', iFlexMenu)
console.log('dashboard.onFlexMenuInit items: ', iFlexMenu.getItems())
iFlexMenu.addItem({
id: 'Custom',
icon: 'sx-icon-menu',
label: 'PageInfo',
color: 'rgba(97, 133, 199, 0.95)',
handler () {
console.log('onFlexMenuClick')
const desc = iDashboard.getStoreValue('desc')
this.$message({
message: desc
})
console.log('dashboard get value: ', desc)
}
})
}
仪表盘组件菜单变化事件
仪表盘组件接口对象
组件菜单接口对象
示例代码
onPortletMenuChange (iPortlet, iPortletMenu) {
console.log('dashboard.onPortletMenuChange: ', iPortlet, iPortletMenu)
console.log('dashboard.onPortletMenuChange items: ', iPortletMenu.getItems())
iPortletMenu.addItem({
order: 10,
id: 'custom',
label: 'XXXXX',
group: 'layout',
handler () {
console.log('onMenuClick')
const desc = iPortlet.getStoreValue('desc')
this.$dialog.MarkDialog({ textarea: desc }).then((res) => {
if (res) {
console.log('page.pageBO');
iPortlet.setStoreValue('desc', res)
}
});
// console.log('portlet save value: ', value)
}
})
}
仪表盘组件菜单展示事件
仪表盘组件接口对象
组件菜单接口对象
示例代码
onPortletMenuShow (iPortlet, iPortletMenu) {
console.log('portlet.onPortletMenuShow: ', iPortlet, iPortletMenu)
console.log('portlet.onPortletMenuShow items: ', iPortletMenu.getItems())
iPortletMenu.addItem({
order: 10,
id: 'Custom',
label: 'PortletInfo',
group: 'layout',
handler () {
console.log('onMenuClick')
console.log(iPortlet, '$dialog');
const desc = iPortlet.getStoreValue('desc')
this.$dialog.MarkDialog({ textarea: desc }).then((res) => {
if (res) {
console.log('page.pageBO');
iPortlet.setStoreValue('desc', res)
}
});
}
})
},
仪表盘组件工具栏变化事件
仪表盘组件接口对象
组件工具栏接口对象
仪表盘组件工具栏展示事件
仪表盘组件接口对象
组件工具栏接口对象
示例代码
onPortletToolbarShow (iPortlet, iToolbar) {
console.log('dashboard.onPortletToolbarShow: ', iPortlet, iToolbar)
console.log('dashboard.onPortletToolbarShow items: ', iToolbar.getItems())
iToolbar.addItem({
id: 'custom',
title: 'PageInfo',
icon: 'sx-icon-menu',
isEmit: true,
show: true,
location: {
edit: true,
view: true,
mobile: true
},
handler () {
console.log('onPortletToolbarClick', iPortlet)
const desc = iPortlet.getStoreValue('desc')
console.log(this);
this.$message({
message: desc
})
console.log('portlet get value: ', desc)
}
})
}
仪表盘二次开发扩展点:命名空间 每个二开实例被创建都是经过一系列的过程,例如需要在仪表盘添加按钮,工具栏等, 同时在这个过程中也会运行一些叫二次开发生命周期钩子的函数, 这给用户在不同阶段添加自己的代码的机会