diff --git a/src/views/Vehicles.vue b/src/views/Vehicles.vue index b2ef808..79c5042 100644 --- a/src/views/Vehicles.vue +++ b/src/views/Vehicles.vue @@ -20,23 +20,23 @@
点击上方添加车辆
-
+
{{ list.length }} 全部
-
+
{{ idleCount }} 空闲
-
+
{{ rentedCount }} 在租
-
+
@@ -156,10 +156,17 @@ const showDialog = ref(false) const editingId = ref(null) const form = ref({ frameNumber: '', plateNumber: '', brand: '', vehicleType: '', color: '', batteryType: '' }) const vehicleTypes = ref([]) +const currentTab = ref('all') const idleCount = computed(() => list.value.filter(v => !v.isRented).length) const rentedCount = computed(() => list.value.filter(v => v.isRented).length) +const filteredList = computed(() => { + if (currentTab.value === 'idle') return list.value.filter(v => !v.isRented) + if (currentTab.value === 'rented') return list.value.filter(v => v.isRented) + return list.value +}) + const brands = computed(() => { const set = new Set(vehicleTypes.value.map(vt => vt.brand).filter(Boolean)) return [...set] @@ -353,6 +360,18 @@ onMounted(() => { flex-direction: column; align-items: center; gap: 2px; + cursor: pointer; + padding: 4px 0; + border-radius: 8px; + transition: background 0.2s; +} + +.stat-item.active { + background: #FFF7F0; +} + +.stat-item:active { + opacity: 0.7; } .stat-num { diff --git a/vite.config.js b/vite.config.js index 9a1b947..70752a6 100644 --- a/vite.config.js +++ b/vite.config.js @@ -13,5 +13,15 @@ export default defineConfig({ changeOrigin: true } } + }, + build: { + rollupOptions: { + output: { + manualChunks: { + 'element-plus': ['element-plus'], + 'vendor': ['vue', 'vue-router', 'axios'] + } + } + } } })