stellar-ui-plus 1.25.3 → 1.25.5
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.
|
@@ -44,8 +44,11 @@ const chartStyle = computed(() => {
|
|
|
44
44
|
return style;
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
+
const thas = ref<ComponentPublicInstance | null>();
|
|
48
|
+
|
|
47
49
|
onMounted(() => {
|
|
48
50
|
ctx.value = uni.createCanvasContext(canvasId.value, getCurrentInstance());
|
|
51
|
+
thas.value = getCurrentInstance()?.proxy;
|
|
49
52
|
drawCharts(props.series);
|
|
50
53
|
});
|
|
51
54
|
|
|
@@ -95,7 +98,7 @@ function tap(e: any) {
|
|
|
95
98
|
charts?.value.touchLegend(e);
|
|
96
99
|
charts?.value.showToolTip(e);
|
|
97
100
|
}
|
|
98
|
-
|
|
101
|
+
|
|
99
102
|
async function getImage() {
|
|
100
103
|
if (props.canvas2d == false) {
|
|
101
104
|
return new Promise(resolve => {
|
|
@@ -117,8 +120,19 @@ async function getImage() {
|
|
|
117
120
|
.fields({ node: true, size: true })
|
|
118
121
|
.exec(res => {
|
|
119
122
|
if (res[0]) {
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
uni.canvasToTempFilePath(
|
|
124
|
+
{
|
|
125
|
+
canvasId: canvasId.value, // 传入 canvas 实例
|
|
126
|
+
success: result => {
|
|
127
|
+
// result.tempFilePath 就是生成的图片路径
|
|
128
|
+
resolve(result.tempFilePath);
|
|
129
|
+
},
|
|
130
|
+
fail: err => {
|
|
131
|
+
reject(err);
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
thas.value
|
|
135
|
+
); // 这里的 thas.value 必须是当前组件实例
|
|
122
136
|
}
|
|
123
137
|
});
|
|
124
138
|
});
|