|
@@ -51,6 +51,21 @@ const registerBasicDiagram = () => {
|
|
|
registerCanvasDraw(ftaPensbyCtx());
|
|
|
registerAnchors(ftaAnchors());
|
|
|
};
|
|
|
+
|
|
|
+//注册所有主题
|
|
|
+const registerTheme = () => {
|
|
|
+ fetch('/theme/dark.json')
|
|
|
+ .then((r) => r.json())
|
|
|
+ .then((theme) => {
|
|
|
+ (globalThis as any).echarts.registerTheme('le-dark', theme);
|
|
|
+ });
|
|
|
+ fetch('/theme/light.json')
|
|
|
+ .then((r) => r.json())
|
|
|
+ .then((theme) => {
|
|
|
+ (globalThis as any).echarts.registerTheme('le-light', theme);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
const open = (id: string) => {
|
|
|
let url = '/json/v.json';
|
|
|
if (id) {
|
|
@@ -105,8 +120,16 @@ const initMeta2d = (id: any) => {
|
|
|
meta2d = new Meta2d('meta2d', options);
|
|
|
//注册基本图形库
|
|
|
registerBasicDiagram();
|
|
|
+ const themetimer = setInterval(() => {
|
|
|
+ if ( (globalThis as any).echarts) {
|
|
|
+ registerTheme();
|
|
|
+ clearInterval(themetimer);
|
|
|
+ }
|
|
|
+ }, 200);
|
|
|
meta2d.on('opened', opened);
|
|
|
- open(id);
|
|
|
+ setTimeout(()=>{
|
|
|
+ open(id);
|
|
|
+ },1000);
|
|
|
setTimeout(async () => {
|
|
|
(globalThis as any).userId = meta2d.store.data.userId;
|
|
|
(globalThis as any).registerIot &&
|