metas-mange.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <div class="mates" v-if="hot.type !== 'TEXT' && hot.type !== 'AUDIO'">
  3. <ui-slide
  4. v-if="hot.meta"
  5. :items="hot.meta"
  6. :showCtrl="hot.meta.length > 1"
  7. :currentIndex="index"
  8. @change="(i) => emit('change', i)"
  9. :showInfos="hot.meta.length > 1 && !hideInfo"
  10. >
  11. <template v-slot="{ raw, index }">
  12. <div
  13. class="meta-item"
  14. :class="{ full: inFull }"
  15. @click="inFull && emit('pull', index)"
  16. >
  17. <img :src="getResources(raw.url)" v-if="hot.type === 'IMAGE'" />
  18. <video
  19. v-else-if="hot.type === 'VIDEO'"
  20. class="video"
  21. autoplay
  22. controls
  23. playsinline
  24. webkit-playsinline
  25. >
  26. <source :src="getResources(raw.url)" type="video/mp4" />
  27. </video>
  28. <div class="iframe" v-else-if="hot.type === 'WEB'">
  29. <iframe :src="getResources(raw.url)"> </iframe>
  30. </div>
  31. </div>
  32. </template>
  33. <template v-slot:attach="{ active }">
  34. <div class="file-mange">
  35. <slot name="icons" :active="active" />
  36. </div>
  37. </template>
  38. </ui-slide>
  39. </div>
  40. </template>
  41. <script setup lang="ts">
  42. import { HotAtom } from "@/store";
  43. import { getResources } from "@/store/app";
  44. defineProps<{
  45. hot: HotAtom;
  46. inFull?: boolean;
  47. index?: number;
  48. hideInfo?: boolean;
  49. }>();
  50. const emit = defineEmits<{
  51. (e: "pull", index: number): void;
  52. (e: "change", i: number): void;
  53. }>();
  54. </script>
  55. <style lang="sass" scoped>
  56. @import './style.scss'
  57. </style>