index.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <teleport to="body">
  3. <span class="close pc" @click="$emit('close')">
  4. <ui-icon type="close" ctrl />
  5. </span>
  6. <div class="pull-preview pc">
  7. <ui-slide
  8. v-if="items.length > 1"
  9. :currentIndex="current"
  10. showCtrl
  11. :items="items"
  12. showInfos
  13. >
  14. <template v-slot="{ raw }">
  15. <Sign :media="raw" />
  16. </template>
  17. </ui-slide>
  18. <Sign :media="items[0]" v-else />
  19. </div>
  20. </teleport>
  21. </template>
  22. <script lang="ts">
  23. import { defineComponent, PropType, ref } from "vue";
  24. import Sign from "./sign.vue";
  25. import { MetaType } from "@/utils";
  26. export type MediaItem = {
  27. url: Blob | string;
  28. type?: MetaType;
  29. };
  30. export const Preview = defineComponent({
  31. name: "static-preview",
  32. props: {
  33. items: {
  34. type: Array as PropType<MediaItem[]>,
  35. required: true,
  36. },
  37. current: {
  38. type: Number,
  39. default: 1,
  40. },
  41. },
  42. emits: {
  43. close: () => true,
  44. },
  45. components: {
  46. Sign,
  47. },
  48. });
  49. export default Preview;
  50. </script>
  51. <style scoped lang="scss" src="./style.scss"></style>