TickerBar self update
This commit is contained in:
parent
8b45718ea5
commit
b6b71daa50
2 changed files with 29 additions and 28 deletions
|
@ -26,11 +26,7 @@
|
|||
/>
|
||||
</template>
|
||||
</Dashboard>
|
||||
<TickerBar
|
||||
v-if="ticker_html !== ''"
|
||||
:content="ticker_html"
|
||||
:color="ticker_color"
|
||||
/>
|
||||
<TickerBar />
|
||||
</v-layout>
|
||||
</v-app>
|
||||
</template>
|
||||
|
@ -74,9 +70,6 @@ export default class App extends Vue {
|
|||
private dashboard_version = "0.0.1";
|
||||
private dashboard_ip = "0.0.0.0";
|
||||
|
||||
private ticker_html = "<p>changeme</p>";
|
||||
private ticker_color = "primary";
|
||||
|
||||
public created(): void {
|
||||
super.created();
|
||||
}
|
||||
|
@ -164,20 +157,6 @@ export default class App extends Vue {
|
|||
this.$ovdashboard.api_get_string("misc/lanip", (data) => {
|
||||
this.dashboard_ip = data;
|
||||
});
|
||||
|
||||
// Update Ticker
|
||||
this.$ovdashboard.api_get_string("ticker/html", (data) => {
|
||||
this.ticker_html = data;
|
||||
});
|
||||
|
||||
// Update Ticker Config
|
||||
type TickerConfig = {
|
||||
color: string;
|
||||
};
|
||||
|
||||
this.$ovdashboard.api_get_object<TickerConfig>("ticker/config", (data) => {
|
||||
this.ticker_color = data.color;
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div>
|
||||
<div v-if="content !== ''">
|
||||
<v-footer :color="color" :dark="is_dark" fixed>
|
||||
<span ref="marquee" class="text-h6" v-html="content" />
|
||||
</v-footer>
|
||||
|
@ -10,16 +10,14 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Ref, Vue, Watch } from "vue-property-decorator";
|
||||
import { Component, Ref, Vue, Watch } from "@/ovd-vue";
|
||||
import Color from "color";
|
||||
|
||||
@Component
|
||||
export default class TickerBar extends Vue {
|
||||
@Prop({ required: true })
|
||||
private readonly content!: string;
|
||||
private content = "<p>changeme</p>";
|
||||
|
||||
@Prop({ default: "primary" })
|
||||
private readonly color!: string;
|
||||
private color = "primary";
|
||||
|
||||
@Ref("content")
|
||||
private readonly _content!: HTMLDivElement;
|
||||
|
@ -59,6 +57,30 @@ export default class TickerBar extends Vue {
|
|||
this._marquee.style.setProperty("animation-duration", `${duration}s`);
|
||||
});
|
||||
}
|
||||
|
||||
public created(): void {
|
||||
super.created();
|
||||
}
|
||||
|
||||
public beforeDestroy(): void {
|
||||
super.beforeDestroy();
|
||||
}
|
||||
|
||||
protected update(): void {
|
||||
// Update Ticker
|
||||
this.$ovdashboard.api_get_string("ticker/html", (data) => {
|
||||
this.content = data;
|
||||
});
|
||||
|
||||
// Update Ticker Config
|
||||
type TickerConfig = {
|
||||
color: string;
|
||||
};
|
||||
|
||||
this.$ovdashboard.api_get_object<TickerConfig>("ticker/config", (data) => {
|
||||
this.color = data.color;
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in a new issue