mirror of
https://github.com/Lissy93/dashy.git
synced 2025-04-08 17:06:18 +02:00
✨ Adds update support to image widget (#992)
This commit is contained in:
parent
3f81acd47e
commit
71291c1ce9
@ -9,10 +9,24 @@ import WidgetMixin from '@/mixins/WidgetMixin';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [WidgetMixin],
|
mixins: [WidgetMixin],
|
||||||
|
data: () => ({
|
||||||
|
updateCount: 0,
|
||||||
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
|
/* The path to image to render */
|
||||||
imagePath() {
|
imagePath() {
|
||||||
if (!this.options.imagePath) this.error('You must specify an imagePath');
|
if (!this.options.imagePath) this.error('You must specify an imagePath');
|
||||||
return this.options.imagePath;
|
return `${this.options.imagePath}${this.updatePathParam}`;
|
||||||
|
},
|
||||||
|
/* Generate a URL param, to be updated in order to re-fetch image */
|
||||||
|
updatePathParam() {
|
||||||
|
return this.updateCount ? `#dashy-update-${this.updateCount}` : '';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/* In order to re-fetch the image, we much update the URL with an arbitrary hash */
|
||||||
|
update() {
|
||||||
|
this.updateCount += 1;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user