stellar-ui-plus 1.25.5 → 1.25.6

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,9 +44,10 @@ const chartStyle = computed(() => {
44
44
  style.height = cHeight.value + 'px';
45
45
  return style;
46
46
  });
47
-
47
+ const thas = ref<ComponentPublicInstance | null>();
48
48
  onMounted(() => {
49
49
  ctx.value = uni.createCanvasContext(canvasId.value, getCurrentInstance());
50
+ thas.value = getCurrentInstance()?.proxy;
50
51
  if (props.series.length) {
51
52
  drawCharts(props.series, props.categories);
52
53
  }
@@ -99,7 +100,6 @@ function tap(e: any) {
99
100
  charts.value?.touchLegend(e);
100
101
  charts.value?.showToolTip(e);
101
102
  }
102
- const thas = ref<ComponentPublicInstance | null>();
103
103
  async function getImage() {
104
104
  if (props.canvas2d == false) {
105
105
  return new Promise(resolve => {
@@ -121,8 +121,19 @@ async function getImage() {
121
121
  .fields({ node: true, size: true })
122
122
  .exec(res => {
123
123
  if (res[0]) {
124
- const canvas = res[0].node;
125
- resolve(canvas.toDataURL('image/png'));
124
+ uni.canvasToTempFilePath(
125
+ {
126
+ canvasId: canvasId.value, // 传入 canvas 实例
127
+ success: result => {
128
+ // result.tempFilePath 就是生成的图片路径
129
+ resolve(result.tempFilePath);
130
+ },
131
+ fail: err => {
132
+ reject(err);
133
+ },
134
+ },
135
+ thas.value
136
+ ); // 这里的 thas.value 必须是当前组件实例
126
137
  }
127
138
  });
128
139
  });
@@ -45,9 +45,10 @@ const chartStyle = computed(() => {
45
45
  style.height = cHeight.value + 'px';
46
46
  return style;
47
47
  });
48
-
48
+ const thas = ref<ComponentPublicInstance | null>();
49
49
  onMounted(() => {
50
50
  ctx.value = uni.createCanvasContext(canvasId.value, getCurrentInstance());
51
+ thas.value = getCurrentInstance()?.proxy;
51
52
  if (props.series.length) drawCharts(props.series);
52
53
  });
53
54
 
@@ -96,7 +97,6 @@ function tap(e: any) {
96
97
  charts.value?.showToolTip(e);
97
98
  }
98
99
 
99
- const thas = ref<ComponentPublicInstance | null>();
100
100
  async function getImage() {
101
101
  if (props.canvas2d == false) {
102
102
  return new Promise(resolve => {
@@ -118,8 +118,19 @@ async function getImage() {
118
118
  .fields({ node: true, size: true })
119
119
  .exec(res => {
120
120
  if (res[0]) {
121
- const canvas = res[0].node;
122
- resolve(canvas.toDataURL('image/png'));
121
+ uni.canvasToTempFilePath(
122
+ {
123
+ canvasId: canvasId.value, // 传入 canvas 实例
124
+ success: result => {
125
+ // result.tempFilePath 就是生成的图片路径
126
+ resolve(result.tempFilePath);
127
+ },
128
+ fail: err => {
129
+ reject(err);
130
+ },
131
+ },
132
+ thas.value
133
+ ); // 这里的 thas.value 必须是当前组件实例
123
134
  }
124
135
  });
125
136
  });
@@ -43,9 +43,10 @@ const chartStyle = computed(() => {
43
43
  style.height = cHeight.value + 'px';
44
44
  return style;
45
45
  });
46
-
46
+ const thas = ref<ComponentPublicInstance | null>();
47
47
  onMounted(() => {
48
48
  ctx.value = uni.createCanvasContext(canvasId.value, getCurrentInstance());
49
+ thas.value = getCurrentInstance()?.proxy;
49
50
  drawCharts(props.series);
50
51
  });
51
52
 
@@ -96,7 +97,6 @@ function tap(e: any) {
96
97
  charts.value?.showToolTip(e);
97
98
  }
98
99
 
99
- const thas = ref<ComponentPublicInstance | null>();
100
100
  async function getImage() {
101
101
  if (props.canvas2d == false) {
102
102
  return new Promise(resolve => {
@@ -118,8 +118,19 @@ async function getImage() {
118
118
  .fields({ node: true, size: true })
119
119
  .exec(res => {
120
120
  if (res[0]) {
121
- const canvas = res[0].node;
122
- resolve(canvas.toDataURL('image/png'));
121
+ uni.canvasToTempFilePath(
122
+ {
123
+ canvasId: canvasId.value, // 传入 canvas 实例
124
+ success: result => {
125
+ // result.tempFilePath 就是生成的图片路径
126
+ resolve(result.tempFilePath);
127
+ },
128
+ fail: err => {
129
+ reject(err);
130
+ },
131
+ },
132
+ thas.value
133
+ ); // 这里的 thas.value 必须是当前组件实例
123
134
  }
124
135
  });
125
136
  });
@@ -45,9 +45,10 @@ const chartStyle = computed(() => {
45
45
  style.height = cHeight.value + 'px';
46
46
  return style;
47
47
  });
48
-
48
+ const thas = ref<ComponentPublicInstance | null>();
49
49
  onMounted(() => {
50
50
  ctx.value = uni.createCanvasContext(canvasId.value, getCurrentInstance());
51
+ thas.value = getCurrentInstance()?.proxy;
51
52
  drawCharts(props.series);
52
53
  });
53
54
 
@@ -99,7 +100,6 @@ function tap(e: any) {
99
100
  charts.value?.showToolTip(e);
100
101
  }
101
102
 
102
- const thas = ref<ComponentPublicInstance | null>();
103
103
  async function getImage() {
104
104
  if (props.canvas2d == false) {
105
105
  return new Promise(resolve => {
@@ -121,8 +121,19 @@ async function getImage() {
121
121
  .fields({ node: true, size: true })
122
122
  .exec(res => {
123
123
  if (res[0]) {
124
- const canvas = res[0].node;
125
- resolve(canvas.toDataURL('image/png'));
124
+ uni.canvasToTempFilePath(
125
+ {
126
+ canvasId: canvasId.value, // 传入 canvas 实例
127
+ success: result => {
128
+ // result.tempFilePath 就是生成的图片路径
129
+ resolve(result.tempFilePath);
130
+ },
131
+ fail: err => {
132
+ reject(err);
133
+ },
134
+ },
135
+ thas.value
136
+ ); // 这里的 thas.value 必须是当前组件实例
126
137
  }
127
138
  });
128
139
  });
@@ -44,9 +44,10 @@ const chartStyle = computed(() => {
44
44
  style.height = cHeight.value + 'px';
45
45
  return style;
46
46
  });
47
-
47
+ const thas = ref<ComponentPublicInstance | null>();
48
48
  onMounted(() => {
49
49
  ctx.value = uni.createCanvasContext(canvasId.value, getCurrentInstance());
50
+ thas.value = getCurrentInstance()?.proxy;
50
51
  if (props.series.length) drawCharts(props.series);
51
52
  });
52
53
 
@@ -98,7 +99,6 @@ function tap(e: any) {
98
99
  charts.value?.showToolTip(e);
99
100
  }
100
101
 
101
- const thas = ref<ComponentPublicInstance | null>();
102
102
  async function getImage() {
103
103
  if (props.canvas2d == false) {
104
104
  return new Promise(resolve => {
@@ -120,8 +120,19 @@ async function getImage() {
120
120
  .fields({ node: true, size: true })
121
121
  .exec(res => {
122
122
  if (res[0]) {
123
- const canvas = res[0].node;
124
- resolve(canvas.toDataURL('image/png'));
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 必须是当前组件实例
125
136
  }
126
137
  });
127
138
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stellar-ui-plus",
3
- "version": "1.25.5",
3
+ "version": "1.25.6",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",