add switch

This commit is contained in:
Fine 2025-05-12 10:36:20 +08:00
parent 060b009ed9
commit 1aad1ef141

View File

@ -48,6 +48,15 @@ limitations under the License. -->
@input="changeTimeRange"
/>
<span> UTC{{ appStore.utcHour >= 0 ? "+" : "" }}{{ `${appStore.utcHour}:${appStore.utcMin}` }} </span>
<span class="ml-5">
<el-switch
v-model="dataMode"
inline-prompt
active-text="Set data to cold"
inactive-text="Set data to warm"
@change="changeDataMode"
/>
</span>
<span class="ml-5" ref="themeSwitchRef">
<el-switch
v-model="theme"
@ -96,6 +105,7 @@ limitations under the License. -->
const pageTitle = ref<string>("");
const theme = ref<boolean>(true);
const themeSwitchRef = ref<HTMLElement>();
const dataMode = ref<boolean>(false);
const savedTheme = window.localStorage.getItem("theme-is-dark");
if (savedTheme === "false") {
@ -126,6 +136,14 @@ limitations under the License. -->
window.localStorage.setItem("theme-is-dark", String(theme.value));
}
function changeDataMode() {
if (dataMode.value) {
// const gap = appStore.duration.end.getTime() - appStore.duration.start.getTime();
// const dates: Date[] = [new Date(new Date().getTime() - gap), new Date()];
// appStore.setDuration(timeFormat(dates));
}
}
function handleChangeTheme() {
const x = themeSwitchRef.value?.offsetLeft ?? 0;
const y = themeSwitchRef.value?.offsetTop ?? 0;