feat: 优化工程页面的用户体验,包括删除一些不必要的元素,同时使用storage保存一些界面参数方便用户体验
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="h-full flex flex-col">
|
||||
<div class="tabs tabs-box flex-shrink-0">
|
||||
<div class="h-full flex flex-col gap-7">
|
||||
<div class="tabs tabs-box flex-shrink-0 shadow-xl">
|
||||
<label class="tab">
|
||||
<input
|
||||
type="radio"
|
||||
@@ -32,7 +32,17 @@
|
||||
<SquareActivityIcon class="icon" />
|
||||
示波器
|
||||
</label>
|
||||
<!-- 全屏按钮 -->
|
||||
<button
|
||||
class="fullscreen-btn ml-auto btn btn-ghost btn-sm"
|
||||
@click="toggleFullscreen"
|
||||
:title="isFullscreen ? '退出全屏' : '全屏'"
|
||||
>
|
||||
<MaximizeIcon v-if="!isFullscreen" class="icon" />
|
||||
<MinimizeIcon v-else class="icon" />
|
||||
</button>
|
||||
</div>
|
||||
<!-- 主页面 -->
|
||||
<div class="flex-1 overflow-hidden">
|
||||
<div v-if="checkID === 1" class="h-full overflow-y-auto"></div>
|
||||
<div v-else-if="checkID === 2" class="h-full overflow-y-auto">
|
||||
@@ -44,21 +54,52 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { VideoIcon, SquareActivityIcon, TerminalIcon } from "lucide-vue-next";
|
||||
import {
|
||||
VideoIcon,
|
||||
SquareActivityIcon,
|
||||
TerminalIcon,
|
||||
MaximizeIcon,
|
||||
MinimizeIcon,
|
||||
} from "lucide-vue-next";
|
||||
import VideoStreamView from "@/views/Project/VideoStream.vue";
|
||||
import OscilloscopeView from "@/views/Project/Oscilloscope.vue";
|
||||
import { isNull, toNumber } from "lodash";
|
||||
import { ref } from "vue";
|
||||
import { ref, watch } from "vue";
|
||||
|
||||
const checkID = ref(1);
|
||||
|
||||
// 定义事件
|
||||
const emit = defineEmits<{
|
||||
toggleFullscreen: [];
|
||||
}>();
|
||||
|
||||
// 接收父组件传递的全屏状态
|
||||
const props = defineProps<{
|
||||
isFullscreen?: boolean;
|
||||
}>();
|
||||
|
||||
const isFullscreen = ref(props.isFullscreen || false);
|
||||
|
||||
// 监听props变化
|
||||
watch(
|
||||
() => props.isFullscreen,
|
||||
(newVal) => {
|
||||
isFullscreen.value = newVal || false;
|
||||
},
|
||||
);
|
||||
|
||||
function handleTabChange(event: Event) {
|
||||
const target = event.currentTarget as HTMLInputElement;
|
||||
if (isNull(target)) return;
|
||||
|
||||
checkID.value = toNumber(target.id);
|
||||
}
|
||||
|
||||
function toggleFullscreen() {
|
||||
emit("toggleFullscreen");
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="postcss">
|
||||
@@ -67,4 +108,16 @@ function handleTabChange(event: Event) {
|
||||
.icon {
|
||||
@apply h-4 w-4 opacity-70 mr-1.5;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
@apply relative flex items-center;
|
||||
}
|
||||
|
||||
.fullscreen-btn {
|
||||
@apply flex items-center justify-center p-2 rounded-lg transition-colors;
|
||||
}
|
||||
|
||||
.fullscreen-btn .icon {
|
||||
@apply mr-0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user