1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
| <template>
| <BaseCard direction="top-left" borderless="t">
| <template #content>
| <el-checkbox-group
| v-model="checkbox"
| size="default"
| @change="handleChange"
| >
| <el-checkbox
| v-for="(item, i) in options"
| :key="i"
| :value="item.value"
| >{{ item.label }}</el-checkbox
| >
| </el-checkbox-group>
| </template>
| </BaseCard>
| </template>
|
| <script>
| // 监测因子单选框
| import { checkboxOptions } from '@/constant/checkbox-options';
| import { TYPE0 } from '@/constant/device-type';
|
| export default {
| props: {
| deviceType: {
| type: String,
| // type0: 车载或无人机; type1:无人船
| default: TYPE0
| }
| },
| emits: ['change'],
| data() {
| return {
| checkbox: [checkboxOptions(TYPE0)[0].value]
| };
| },
| computed: {
| options() {
| return checkboxOptions(this.deviceType);
| }
| },
| watch: {
| deviceType(nV, oV) {
| if (nV != oV) {
| this.checkbox = this.options[0].value;
| }
| }
| },
| methods: {
| handleChange(value) {
| this.$emit('change', value);
| }
| }
| };
| </script>
| <style scoped>
| .el-checkbox {
| --el-checkbox-text-color: white;
| margin-right: 6px;
| /* height: initial; */
| }
| </style>
|
|