index.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <div class="app-container">
  3. <div class="office-container">
  4. <el-tooltip class="item" effect="dark" content="D301办公楼" placement="top">
  5. <div class="office"
  6. id="office"
  7. @mouseover="handleMouseover1"
  8. @mouseleave="handleMouseleave1"
  9. @click="handleDevClick('D301办公楼')">
  10. </div>
  11. </el-tooltip>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. export default {
  17. props: {
  18. area: {
  19. type: String,
  20. default: ''
  21. },
  22. },
  23. methods: {
  24. handleDevClick(devName) {
  25. this.$emit('handleDevClick', devName);
  26. },
  27. /* mouseover事件 */
  28. handleMouseover1() {
  29. let box = document.getElementById("office");
  30. box.style.backgroundColor = "rgba(64,158,255,0.3)";//蓝色
  31. box.style.cursor = "pointer";
  32. },
  33. /* mouseleave事件 */
  34. handleMouseleave1() {
  35. let box = document.getElementById("office");
  36. box.style.backgroundColor = "transparent";
  37. },
  38. }
  39. }
  40. </script>
  41. <style>
  42. .office-container {
  43. position: relative;
  44. width: 1200px;
  45. height: 400px;
  46. padding: 0px;
  47. margin: 0px auto;
  48. overflow: hidden;
  49. background: url('../../../assets/images/aerial/office.png') center/cover; /* 替换为实际背景图路径 */
  50. background-size: contain;
  51. background-repeat: no-repeat;
  52. }
  53. .office {
  54. position:absolute;
  55. top: 80px;
  56. left: 80px;
  57. padding: 0px;
  58. margin: 0px;
  59. width: 1040px;
  60. height: 230px;
  61. }
  62. </style>