analyzeWork.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <!-- 分析工况 -->
  3. <div style="height: 100%;">
  4. <el-card class="custom-card">
  5. <template #header>
  6. <span>分析工况</span>
  7. </template>
  8. <el-space style="height: 100%;">
  9. <div v-for="item in btninfo">
  10. <el-button
  11. :key="item.name"
  12. class="work-btn"
  13. @click="handleWorkClick(item.name)"
  14. >
  15. <img
  16. :src="selectedWork === item.name ? item.highlightImg : item.img"
  17. alt="work icon"
  18. />
  19. <!-- {{ item.name }} -->
  20. </el-button>
  21. </div>
  22. </el-space>
  23. </el-card>
  24. </div>
  25. </template>
  26. <script setup>
  27. import qidong from '@/assets/img/qidong.png'
  28. import jiegou from '@/assets/img/jiegou.png'
  29. import qitan from '@/assets/img/qitan.png'
  30. import qidong1 from '@/assets/img/qidong1.png'
  31. import jiegou1 from '@/assets/img/jiegou1.png'
  32. import qitan1 from '@/assets/img/qitan1.png'
  33. const selectedWork = ref('气动')
  34. const btninfo = ref([
  35. { name: '气动', img: qidong, highlightImg: qidong1 },
  36. { name: '结构', img: jiegou, highlightImg: jiegou1 },
  37. { name: '气弹', img: qitan, highlightImg: qitan1 },
  38. ])
  39. const handleWorkClick = (name) => {
  40. selectedWork.value = name
  41. }
  42. </script>
  43. <style scoped>
  44. .custom-card {
  45. width: 100%;
  46. height: 100%;
  47. }
  48. .work-btn {
  49. width: 100%;
  50. height: 100%;
  51. display: flex;
  52. flex-direction: column;
  53. align-items: center;
  54. justify-content: center;
  55. background-color: transparent;
  56. border: none;
  57. }
  58. </style>