sign.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <ui-group-option class="sign-tagging" :class="{active: selected}" @click="emit('select')">
  3. <div class="info">
  4. <img :src="getFileUrl(tagging.images[0])">
  5. <div>
  6. <p>{{ tagging.title }}</p>
  7. <a>放置:{{ tagging.positions.length }}</a>
  8. </div>
  9. </div>
  10. <div class="actions" @click.stop>
  11. <ui-icon type="pin" ctrl />
  12. <ui-more
  13. :options="menus"
  14. style="margin-left: 20px"
  15. @click="(action: keyof typeof actions) => actions[action]()"
  16. />
  17. </div>
  18. </ui-group-option>
  19. </template>
  20. <script setup lang="ts">
  21. import { Tagging } from '@/store'
  22. import { getFileUrl } from '@/utils'
  23. defineProps<{ tagging: Tagging, selected?: boolean }>()
  24. const emit = defineEmits<{
  25. (e: 'delete'): void
  26. (e: 'edit'): void
  27. (e: 'select'): void
  28. }>()
  29. const menus = [
  30. { label: '编辑', value: 'edit' },
  31. { label: '删除', value: 'delete' },
  32. ]
  33. const actions = {
  34. edit: () => emit('edit'),
  35. delete: () => emit('delete')
  36. }
  37. </script>
  38. <style lang="scss" scoped src="./style.scss"></style>