From aa75a9d46ee325f0a92e42f733aabb1f92103aeb Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期五, 28 三月 2025 17:44:29 +0800 Subject: [PATCH] 走航融合模块完成 --- src/components/monitor/FactorRadio.vue | 54 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 49 insertions(+), 5 deletions(-) diff --git a/src/components/monitor/FactorRadio.vue b/src/components/monitor/FactorRadio.vue index 3245049..c686f68 100644 --- a/src/components/monitor/FactorRadio.vue +++ b/src/components/monitor/FactorRadio.vue @@ -1,10 +1,10 @@ <template> <BaseCard> <template #content> - <el-radio-group v-model="radio"> - <el-radio :value="3">Option A</el-radio> - <el-radio :value="6">Option B</el-radio> - <el-radio :value="9">Option C</el-radio> + <el-radio-group v-model="radio" size="default" @change="handleChange"> + <el-radio v-for="(item, i) in options" :key="i" :value="item.value">{{ + item.label + }}</el-radio> </el-radio-group> </template> </BaseCard> @@ -12,5 +12,49 @@ <script> // 鐩戞祴鍥犲瓙鍗曢�夋 -export default {}; +import { radioOptions, defaultOptions } from '@/constant/radio-options'; +import { TYPE0 } from '@/constant/device-type'; + +export default { + props: { + deviceType: { + type: String, + // type0: 杞﹁浇鎴栨棤浜烘満; type1:鏃犱汉鑸� + default: TYPE0 + } + }, + emits: ['change'], + data() { + return { + radio: defaultOptions(TYPE0).value + }; + }, + computed: { + options() { + return radioOptions(this.deviceType); + } + }, + watch: { + deviceType(nV, oV) { + if (nV != oV) { + this.radio = this.options[0].value; + } + } + }, + methods: { + handleChange(value) { + const item = this.options.find((v) => v.value == value); + this.$emit('change', item.value, item); + // todo 鍦板浘3d鍥惧儚鍒囨崲灞曠ず鐩戞祴鍥犲瓙 + } + } +}; </script> +<style scoped> +.el-radio { + --el-radio-text-color: white; + --el-color-primary: #23dad1; + margin-right: 10px; + height: initial; +} +</style> -- Gitblit v1.9.3