diff --git a/src/hooks/useLifeHandler.hook.ts b/src/hooks/useLifeHandler.hook.ts index cd7ef9a9..aa0d557b 100644 --- a/src/hooks/useLifeHandler.hook.ts +++ b/src/hooks/useLifeHandler.hook.ts @@ -32,6 +32,7 @@ export const useLifeHandler = (chartConfig: CreateComponentType) => { */ function generateFunc(fnStr: string, e: any) { try { + // npmPkgs 便于拷贝 echarts 示例时设置option 的formatter等相关内容 Function(` "use strict"; return ( @@ -39,9 +40,7 @@ function generateFunc(fnStr: string, e: any) { const {${Object.keys(npmPkgs).join()}} = node_modules; ${fnStr} } - )`)().bind(e?.component) - // 便于拷贝echarts示例时设置option 的formatter等相关内容 - e, components, npmPkgs + )`)().bind(e?.component)(e, components, npmPkgs) } catch (error) { console.error(error) } diff --git a/src/packages/index.d.ts b/src/packages/index.d.ts index 35fc0cbf..94e90c91 100644 --- a/src/packages/index.d.ts +++ b/src/packages/index.d.ts @@ -92,8 +92,10 @@ export const BlendModeEnumList = [ // vue3 生命周期事件 export enum EventLife { + // 渲染之后 + MOUNTED = 'vnodeMounted', + // 渲染之前 BEFORE_MOUNT = 'vnodeBeforeMount', - MOUNTED = 'vnodeMounted' } // 组件实例类 diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventMonacoEditor/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventMonacoEditor/index.vue index 8d68ccbe..c422fc20 100644 --- a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventMonacoEditor/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventMonacoEditor/index.vue @@ -2,7 +2,9 @@
-

async {{eventName}} (e) {

+

+ async {{ eventName }} (e, components, echarts, node_modules) { +

},

@@ -25,84 +27,109 @@ - - -
-
-
- - - -

},

-
-
-
-
- - - - - - - - - - - 以下变量均可在代码块中使用 - - - 触发对应生命周期事件时接收的参数 - - - 图表组件实例
- {{ prop }}... -
- - 当前大屏内所有组件的集合id 图表组件中的配置id,可以获取其他图表组件进行控制 - - - - 以下是内置在代码环境中可用的包变量 - {{ pkg }} - -
-
- - - - - - -
-
+ + + + + + + +

+ async function    + {{ eventName }}(e, components, echarts, node_modules)  { +

+ + + +

}

+
+
+ + + + + + + + + + + + + + + + 触发对应生命周期事件时接收的参数 + + + 图表组件实例 +
+ {{ + prop + }} +
+ + 当前大屏内所有组件的集合id 图表组件中的配置id,可以获取其他图表组件进行控制 + + + + 以下是内置在代码环境中可用的包变量 +
+ {{ pkg }} +
+
+
+
+ + + +
+ 浏览器是否兼容 「importmap」: + + {{ hTMLScriptElement.supports('importmap') ? '√' : '×' }} + + +
+
+
+
+
+