sceneList.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div class="scene-list">
  3. <div class="header">
  4. <p>场景列表({{ sceneList.length }})</p>
  5. <span class="icon" @click="emit('close')">
  6. <Icon type="cross@2x" />
  7. </span>
  8. </div>
  9. <div class="content">
  10. <div
  11. class="sign"
  12. v-for="scene in sceneList"
  13. :key="scene.id"
  14. @click="emit('changeScene', scene)"
  15. :class="{ active: currentScene === scene }"
  16. >
  17. <div class="info">
  18. <img :src="scene.thumb" />
  19. <p>{{ scene.sceneName }}</p>
  20. </div>
  21. <span class="icon">
  22. <Icon type="arrow@2x" v-if="currentScene !== scene" />
  23. </span>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script lang="ts" setup>
  29. import { unref } from "vue";
  30. import Icon from "/@/components/basic/icon/index.vue";
  31. import { useRoom } from "/@/hooks/useRoom";
  32. // import { currentScene } from "@/store/room";
  33. const { currentScene, sceneList } = useRoom();
  34. console.log("sceneList", unref(sceneList));
  35. const emit = defineEmits(["close", "changeScene"]);
  36. </script>
  37. <style scoped lang="scss">
  38. .scene-list {
  39. max-height: 80%;
  40. background: rgba(0, 0, 0, 0.8);
  41. border-radius: 10px 10px 0px 0px;
  42. bottom: 0;
  43. left: 0;
  44. right: 0;
  45. display: flex;
  46. flex-direction: column;
  47. z-index: 99999;
  48. position: absolute;
  49. }
  50. .header {
  51. flex: none;
  52. text-align: center;
  53. height: 46px;
  54. line-height: 46px;
  55. border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  56. p {
  57. font-size: 16px;
  58. font-weight: 500;
  59. color: #ffffff;
  60. }
  61. .icon {
  62. position: absolute;
  63. right: 0;
  64. top: 0;
  65. font-size: 14px;
  66. padding: 0 20px;
  67. }
  68. }
  69. .content {
  70. flex: 1;
  71. overflow-y: auto;
  72. padding: 11px;
  73. .sign {
  74. height: 60px;
  75. display: flex;
  76. justify-content: space-between;
  77. align-items: center;
  78. margin-bottom: 18px;
  79. .info {
  80. flex: 1;
  81. display: flex;
  82. align-items: center;
  83. img {
  84. flex: none;
  85. width: 60px;
  86. height: 60px;
  87. border-radius: 4px;
  88. }
  89. p {
  90. font-size: 14px;
  91. font-weight: 400;
  92. color: #ffffff;
  93. line-height: 20px;
  94. margin-left: 10px;
  95. }
  96. }
  97. &.active .info p {
  98. color: #ed6155;
  99. }
  100. .icon {
  101. flex: none;
  102. font-size: 10px;
  103. margin-left: 20px;
  104. }
  105. }
  106. }
  107. </style>