baoshiwei
6 天以前 2ad852ee08e21ee681950f1d6058499248baf88e
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
65
<!-- <script setup lang="ts">
 
 
const emit = defineEmits<{
  (e: 'update:currentDisplay', value: string): void;
}>();
 
const displayOptions = [
  { value: 'line', label: '曲线图' },
  { value: 'gauge', label: '仪表盘' },
  { value: 'table', label: '数据表格' },
  { value: '3d', label: '3D坐标轴' }
];
 
function handleDisplayChange(value: string) {
  emit('update:currentDisplay', value);
}
</script>
 
<template>
  <div class="display-selector">
    <div class="selector-group">
      <button
        v-for="option in displayOptions"
        :key="option.value"
        :class="['display-button', { active: currentDisplay === option.value }]"
        @click="handleDisplayChange(option.value)"
      >
        {{ option.label }}
      </button>
    </div>
  </div>
</template>
 
<style scoped>
.display-selector {
  margin: 10px 0;
  padding: 0 20px;
}
 
.selector-group {
  display: flex;
  gap: 10px;
  justify-content: center;
}
 
.display-button {
  padding: 8px 16px;
  border-radius: 20px;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: all 0.3s ease;
}
 
.display-button:hover {
  background-color: #e0e0e0;
}
 
.display-button.active {
  background-color: #396cd8;
  color: white;
  border-color: #396cd8;
}
</style> -->