您好,这是高级分析查看器和标准版查看器的一个demo。
仪表板实例初始化后,用户可以监听事件(show.modal / hide.modal)
const appConfig: IAppConfig = {
...config,
...global.wynbi,
token,
};
const ins = global.WynBi.create('DashboardViewer', appConfig);
ins.initialize({
container: document.querySelector('#root'),
}).then(() => {
ins.on('show.modal', (e) => {
console.log('>>> show modal', e);
});
ins.on('hide.modal', (e) => {
console.log('>>> close modal', e);
});
});
// lite
const appConfig: IAppConfig = {
...config,
...global.wynbi,
token,
};
const ins = global.WynBi.createViewerLite(appConfig);
const container = document.querySelector('#root');
const dom = document.createElement('div');
dom.className = 'dashboard-container';
container.appendChild(dom);
ins.initialize({
container,
}).then((dash) => {
// ...connect UIDashboard
ins.on('show.modal', (e) => {
console.log('>>> show modal', e);
});
ins.on('hide.modal', (e) => {
console.log('>>> close modal', e);
});
}, (err) => {
console.log(err);
}); |