diff --git a/src/components/Oscilloscope/OscilloscopeWaveformDisplay.vue b/src/components/Oscilloscope/OscilloscopeWaveformDisplay.vue index 0960d64..e0264ea 100644 --- a/src/components/Oscilloscope/OscilloscopeWaveformDisplay.vue +++ b/src/components/Oscilloscope/OscilloscopeWaveformDisplay.vue @@ -1,11 +1,40 @@ @@ -37,6 +66,7 @@ import type { GridComponentOption, } from "echarts/components"; import { useRequiredInjection } from "@/utils/Common"; +import { Play, Square } from "lucide-vue-next"; use([ TooltipComponent, @@ -58,7 +88,9 @@ type EChartsOption = ComposeOption< >; // 使用 manager 获取 oscilloscope 数据 -const { oscData } = useRequiredInjection(useOscilloscopeState); +const oscManager = useRequiredInjection(useOscilloscopeState); + +const oscData = computed(() => oscManager.oscData.value); const hasData = computed(() => { return ( @@ -66,11 +98,9 @@ const hasData = computed(() => { oscData.value.x && oscData.value.y && oscData.value.x.length > 0 && - ( - Array.isArray(oscData.value.y[0]) - ? oscData.value.y.some((channel: any) => channel.length > 0) - : oscData.value.y.length > 0 - ) + (Array.isArray(oscData.value.y[0]) + ? oscData.value.y.some((channel: any) => channel.length > 0) + : oscData.value.y.length > 0) ); }); diff --git a/src/views/Project/Oscilloscope.vue b/src/views/Project/Oscilloscope.vue index 3c5f801..9da0ae1 100644 --- a/src/views/Project/Oscilloscope.vue +++ b/src/views/Project/Oscilloscope.vue @@ -1,5 +1,5 @@ @@ -17,7 +139,15 @@ import { Activity } from "lucide-vue-next"; import { OscilloscopeWaveformDisplay } from "@/components/Oscilloscope"; import { useEquipments } from "@/stores/equipments"; +import { useOscilloscopeState } from "@/components/Oscilloscope/OscilloscopeManager"; +import { useRequiredInjection } from "@/utils/Common"; // 使用全局设备配置 const equipments = useEquipments(); + +// 获取示波器状态和操作 +const osc = useRequiredInjection(useOscilloscopeState); + +// 应用配置 +const applyConfiguration = () => osc.applyConfiguration();