This commit is contained in:
2020-11-02 17:43:08 +00:00
parent 302c9f2d48
commit d081c6cfd7
3 changed files with 26 additions and 6 deletions

View File

@@ -1,6 +1,5 @@
<template>
<v-sheet color="white" elevation="4" height="300" style="overflow: hidden;">
<!-- todo: need type icon and badge with count options in title bar (badge is icon?) -->
<slot name="dash-title">
<v-toolbar flat dense>
<template v-if="hasUrl">
@@ -112,7 +111,11 @@
</template>
<script>
export default {
data: () => ({}),
data() {
return {
timer: ""
};
},
props: {
id: {
type: String,
@@ -124,11 +127,27 @@ export default {
updateFrequency: { type: Number, default: 60000 },
icon: { type: String, default: "$ayiTachometer" }
},
created() {
this.refresh();
if (this.updateFrequency > 0) {
this.timer = setInterval(() => {
this.refresh();
}, this.updateFrequency);
}
},
beforeDestroy() {
clearInterval(this.timer);
},
computed: {
hasUrl: function() {
return this.moreUrl && this.moreUrl != "";
}
},
methods: {}
methods: {
refresh: function() {
console.log("dash-base:refresh()", new Date());
this.$emit("dash-refresh", this.id);
}
}
};
</script>