@vmz/plugin-echarts 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Echarts.vmz +23 -24
- package/package.json +2 -2
package/components/Echarts.vmz
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
2
|
+
<div data-vmz-echarts class="echarts-host" style="min-height: 320px; width: 100%" />
|
|
3
3
|
</template>
|
|
4
|
-
|
|
5
4
|
<script client>
|
|
6
|
-
import { mountEcharts } from
|
|
5
|
+
import { mountEcharts } from "@vmz/plugin-echarts/runtime";
|
|
7
6
|
|
|
8
7
|
export default class Echarts {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
public option: any = null;
|
|
9
|
+
public theme: string | null = null;
|
|
10
|
+
public renderer: string = "canvas";
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
#api: { setOption: (o: any, notMerge?: boolean) => void; dispose: () => void } | null = null;
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
async onMount() {
|
|
15
|
+
const root = this.__vmzDomRoot;
|
|
16
|
+
const el =
|
|
17
|
+
(root && root.nodeType === 1 && root.matches?.("[data-vmz-echarts]") && root) ||
|
|
18
|
+
root?.querySelector?.("[data-vmz-echarts]") ||
|
|
19
|
+
root;
|
|
20
|
+
if (!el || el.nodeType !== 1) return;
|
|
21
|
+
this.#api = await mountEcharts(el, {
|
|
22
|
+
option: this.option,
|
|
23
|
+
theme: this.theme,
|
|
24
|
+
renderer: this.renderer === "svg" ? "svg" : "canvas",
|
|
25
|
+
});
|
|
26
|
+
}
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
onDestroy() {
|
|
29
|
+
this.#api?.dispose();
|
|
30
|
+
this.#api = null;
|
|
31
|
+
}
|
|
33
32
|
}
|
|
34
33
|
</script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vmz/plugin-echarts",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "VMZ ECharts chart adapter - <Echarts>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@vmz/plugin": "0.2.
|
|
20
|
+
"@vmz/plugin": "0.2.4"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"echarts": ">=5"
|