Skip to content

Commit 0dd65f8

Browse files
committed
Add key to download button
1 parent 4ba196c commit 0dd65f8

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vueplotlib",
3-
"version": "1.3.2",
3+
"version": "1.3.3",
44
"private": false,
55
"scripts": {
66
"serve": "vue-cli-service serve --open ./examples-src/index.js",

src/components/PlotContainer.vue

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ export default {
147147
default: "plot"
148148
}
149149
},
150+
data() {
151+
return {
152+
initialKey: 1
153+
}
154+
},
150155
render(h) {
151156
this.$slots.axisTop = addProp(this.$slots.axisTop, this.$props);
152157
this.$slots.axisLeft = addProp(this.$slots.axisLeft, this.$props);
@@ -163,7 +168,7 @@ export default {
163168
);
164169
165170
if(this.showDownloadButton) {
166-
children.push(h('svg', { props: this.$props, class: 'vdp-plot-container-dl-btn', attrs: {'width': this.downloadButtonSize, 'height': this.downloadButtonSize, 'viewBox': '0 0 24 24'}, style: {'top': (this.downloadButtonOffsetY + 'px'), 'left': (this.downloadButtonOffsetX + 'px')}, on: { click: this.downloadViaButton } }, [h('path', {attrs: {'d': DOWNLOAD_PATH, 'fill': this.downloadButtonFill }})]));
171+
children.push(h('svg', { key: this.initialKey, class: 'vdp-plot-container-dl-btn', attrs: {'width': this.downloadButtonSize, 'height': this.downloadButtonSize, 'viewBox': '0 0 24 24'}, style: {'top': (this.downloadButtonOffsetY + 'px'), 'left': (this.downloadButtonOffsetX + 'px')}, on: { click: this.downloadViaButton } }, [h('path', {attrs: {'d': DOWNLOAD_PATH, 'fill': this.downloadButtonFill }})]));
167172
}
168173
169174
let classes = ['vdp-plot-container'];
@@ -181,7 +186,30 @@ export default {
181186
return this.pMarginTop + this.pHeight + this.pMarginBottom;
182187
}
183188
},
189+
watch: {
190+
pWidth() {
191+
this.initialKey++;
192+
},
193+
pHeight() {
194+
this.initialKey++;
195+
},
196+
pMarginTop() {
197+
this.initialKey++;
198+
},
199+
pMarginLeft() {
200+
this.initialKey++;
201+
},
202+
pMarginRight() {
203+
this.initialKey++;
204+
},
205+
pMarginBottom() {
206+
this.initialKey++;
207+
}
208+
},
184209
methods: {
210+
rerender() {
211+
this.initialKey++;
212+
},
185213
renderToContext(ctx, x, y, uri) {
186214
var img = new Image;
187215
img.onload = () => {

0 commit comments

Comments
 (0)