chenzhou/src/store/settings.js

39 lines
968 B
JavaScript
Raw Normal View History

2024-01-22 11:25:13 +08:00
import { defineStore } from "pinia";
import { ref } from "vue";
export const useSettings = defineStore("settings", () => {
const settings = ref({
resolution: {
2024-01-22 14:23:50 +08:00
width: 1920,
height: 1080,
2024-01-22 11:25:13 +08:00
},
2024-01-22 14:23:50 +08:00
carousel: false,
carouselTime: 1000, // s
2024-01-22 11:25:13 +08:00
fullscreen: false,
2024-01-22 14:23:50 +08:00
eqStatus: false,
2024-01-22 11:25:13 +08:00
});
2024-01-22 14:23:50 +08:00
function rewriteSettings(payload) {
settings.value = payload;
}
function updateSettings({ type, value }) {
switch (type) {
case "carousel":
settings.value.carousel = !settings.value.carousel;
break;
case "fullscreen":
settings.value.fullscreen = !settings.value.fullscreen;
break;
case "eq":
settings.value.eqStatus = !settings.value.eqStatus;
break;
case "resolution":
settings.value.resolution.height = value.height;
settings.value.resolution.width = value.width;
break;
}
}
return { settings, updateSettings, rewriteSettings };
2024-01-22 11:25:13 +08:00
});