update Slider

This commit is contained in:
DESKTOP-FUDKNA8\znjsz 2024-01-17 15:47:17 +08:00
부모 8d0aa21332
커밋 7e2c6fe665
3개의 변경된 파일34개의 추가작업 그리고 22개의 파일을 삭제

파일 보기

@ -1,12 +1,12 @@
<script setup>
import { ref, watch, computed } from "vue";
import { ref, onMounted } from "vue";
import MainPage from "./MainPage.vue";
import Slider from "./components/Slider.vue";
import Client from "./utils/ws";
import { useWsStore } from "./store";
const store = useWsStore();
const url = "ws://192.168.1.101:8082/QbMonitoring/websocket";
let urlPath = document.location.pathname;
if (urlPath === "/") {
@ -41,6 +41,11 @@ new Client(
}
);
const size = ref(80);
onMounted(() => {
setSize(size.value);
});
const styles = ref({});
function setSize(value) {
const v = (value / 100).toFixed(2);
@ -56,7 +61,7 @@ function setSize(value) {
<template>
<div id="app-container">
<MainPage :style="styles" />
<Slider @size-change="setSize" />
<Slider :size="size" @size-change="setSize" />
</div>
</template>

파일 보기

@ -1,34 +1,42 @@
<script setup>
import { ref, watch, onMounted } from 'vue';
const emit = defineEmits(['size-change']);
const size = ref(100);
const slider = ref(null);
// watchers
watch(size, (value) => {
if (value == null) return;
emit('size-change', value);
import { ref, watch, computed, onMounted } from "vue";
const props = defineProps({
size: {
type: Number,
default: 60,
},
});
const emit = defineEmits(["size-change"]);
const slider = ref(null);
const innerSize = ref(props.size);
// watch
watch(
() => innerSize.value,
(value) => {
emit("size-change", value);
}
);
// handlers
function keydownHandler(e) {
if (e.shiftKey && e.key === 'L') {
if (e.shiftKey && e.key === "L") {
if (slider.value) {
slider.value.classList.toggle('show');
slider.value.classList.toggle("show");
}
}
}
// hooks
onMounted(() => {
document.addEventListener('keydown', keydownHandler);
document.addEventListener("keydown", keydownHandler);
});
</script>
<template>
<div ref="slider" class="slider">
<input type="range" min="0" max="100" v-model="size" />
<input type="range" min="0" max="100" v-model="innerSize" />
</div>
</template>

파일 보기

@ -10,15 +10,14 @@ const horizontal_content = ref("公告加载中...");
const store = useWsStore();
store.$subscribe((mutation, state) => {
vertical_content.value =
(state.data3.deliveryNotification || []).map(
(item) => item.deliveryContent || ""
).join('').replaceAll(/<br(\s?)\/>/g, '') || "暂无公告";
(state.data3.deliveryNotification || [])
.map((item) => item.deliveryContent || "")
.join("")
.replaceAll(/<br(\s?)\/>/g, "") || "暂无公告";
horizontal_content.value =
(state.data2.deliveryMsg || [])
.map((item) => item.deliveryContent || "")
.join("\t") || "暂无公告";
console.log('vertical_content.value', vertical_content.value)
});
// handlers