+
+ ` +
+ '$' +
+ `{Object.entries(params[0].value).map(kv => ` +
+ '`' +
+ `
` +
+ '$' +
+ `{kv[0]}:` +
+ '$' +
+ `{kv[1]}
` +
+ '`' +
+ `).join('')}
+
+ ` +
+ '`;' +
+ `
+ },
+ }
+})
+`
+
+// 添加【轮播列表】样式
+const addStyleString =
+ `
+// 组件样式作用域标识
+const scoped = this.subTree.scopeId
+function loadStyleString(css){
+ let style = document.createElement('style')
+ style.type = 'text/css'
+ style.appendChild(document.createTextNode(css))
+ let head = document.getElementsByTagName('head')[0]
+ head.appendChild(style)
+}
+loadStyleString(` +
+ '`' +
+ `
+.dv-scroll-board[` +
+ '$' +
+ `{scoped}] {
+ position: relative;
+ overflow: hidden;
+}
+.dv-scroll-board[` +
+ '$' +
+ `{scoped}]::before {
+ content: '';
+ display: block;
+ position: absolute;
+ top: -20%;
+ left: -100%;
+ width: 550px;
+ height: 60px;
+ transform: rotate(-45deg);
+ background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(255, 255, 255, 0.3), rgba(0, 0, 0, 0));
+ animation: cross 2s infinite;
+}
+@keyframes cross{
+ to{
+ top: 80%;
+ left: 100%;
+ transform: rotate(-45deg);
+ }
+}
+` +
+ '`' +
+ `)
+`
+
+// 修改地图原点大小
+const editMapPointString = `
+const chart = this.refs.vChartRef.chart
+// 定义地图原点大小 同理可自定义标签等等内容
+this.props.chartConfig.option.series[0].symbolSize = (val) => {
+ return Math.sqrt(val[2]) / 3;
+}
+this.setupState.vEchartsSetOption();
+let i = 0; // 当前轮播索引
+const len = 3; // 轮播部分提示
+(function showTips() {
+ const action = (type, dataIndex) => {
+ chart.dispatchAction({
+ type,
+ dataIndex,
+ seriesIndex: 0,
+ });
+ }
+ setInterval(() => {
+ action("downplay", i);
+ action("hideTip", i);
+ if (i === len) i = 0;
+ i++;
+ action("highlight", i);
+ action("showTip", i);
+ }, 2000);
+})()
+`
+
+export const templateList = [
+ {
+ description: '获取当前组件实例',
+ code: eTemplateString
+ },
+ {
+ description: '获取全局 echarts 实例',
+ code: echartsTemplateString
+ },
+ {
+ description: '获取组件图表集合',
+ code: componentsTemplateString
+ },
+ {
+ description: '获取 nodeModules 实例',
+ code: nodeModulesTemplateString
+ },
+ {
+ description: '获取远程 CDN 库',
+ code: importTemplateString
+ },
+ {
+ description: '修改图表 tooltip',
+ code: tooltipTemplateString
+ },
+ {
+ description: '添加【轮播列表】样式',
+ code: addStyleString
+ },
+ {
+ description: '修改地图圆点大小',
+ code: editMapPointString
+ }
+]
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 c422fc20..236bd304 100644
--- a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventMonacoEditor/index.vue
+++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventMonacoEditor/index.vue
@@ -1,33 +1,33 @@
-
-
-
-
- async {{ eventName }} (e, components, echarts, node_modules) {
-
-
-
},
-
-
-
-
-
-
-
-
-
- 编辑
-
-
+
+
+
+
+
+
+
+
+ 编辑
+
-
+
+
+
+
+ async {{ eventName }} (e, components, echarts, node_modules) {
+
+
+
},
+
+
+
- 事件编辑器
+ 事件编辑器(配合源码使用)
@@ -36,7 +36,7 @@
- {{ EventLifeTip[editTab] }}
+ tips: {{ EventLifeTip[editTab] }}
-
+
-
+
{{ error.errorFn || '暂无' }}
-
+
{{ error.name || '暂无' }}
-
+
{{ error.message || '暂无' }}
@@ -85,24 +85,24 @@
-
-
+
+
触发对应生命周期事件时接收的参数
-
+
图表组件实例
{{
prop
}}
-
+
当前大屏内所有组件的集合id 图表组件中的配置id,可以获取其他图表组件进行控制
-
+
以下是内置在代码环境中可用的包变量
{{ pkg }}
@@ -110,21 +110,19 @@
-
-
+
+
-
- 浏览器是否兼容 「importmap」:
-
- {{ hTMLScriptElement.supports('importmap') ? '√' : '×' }}
-
-
-
+
+
+
+
+
@@ -157,6 +155,7 @@ const react = await import('https://cdn.skypack.dev/react@17.0.1')`"
import { ref, computed, watch, toRefs, toRaw } from 'vue'
import { MonacoEditor } from '@/components/Pages/MonacoEditor'
import { useTargetData } from '../../../hooks/useTargetData.hook'
+import { templateList } from './importTemplate'
import { npmPkgs } from '@/hooks'
import { icon } from '@/plugins'
import { goDialog, toString } from '@/utils'
@@ -164,9 +163,7 @@ import { CreateComponentType, EventLife } from '@/packages/index.d'
import { Script } from 'vm'
const { targetData, chartEditStore } = useTargetData()
-const { DocumentTextIcon, ChevronDownIcon } = icon.ionicons5
-const { FilterEditIcon } = icon.carbon
-const hTMLScriptElement = HTMLScriptElement as any
+const { DocumentTextIcon, ChevronDownIcon, PencilIcon } = icon.ionicons5
const EventLifeName = {
[EventLife.BEFORE_MOUNT]: '渲染之前',
diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue
index 887f9e12..e60a7731 100644
--- a/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue
+++ b/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue
@@ -1,29 +1,24 @@
-
+
组件 id:
{{ targetData.id }}
-
-
-
-
+
+
+ 【单击、双击、移入、移出】尽情期待!
+
+
-
+const { targetData } = useTargetData()
+const showModal = ref(false)
+