index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <n-modal class="go-modal-card" v-model:show="showModal">
  3. <slot name="default">
  4. <n-card hoverable size="small">
  5. <div class="list-content">
  6. <!-- 顶部按钮 -->
  7. <n-space class="list-content-top">
  8. <AppleControlBtn
  9. :narrow="true"
  10. :hidden="['close']"
  11. @remove="closeHandle"
  12. />
  13. </n-space>
  14. <!-- 中间 -->
  15. <div class="list-content-img">
  16. <img
  17. :src="
  18. requireUrl(
  19. '../assets/images/project',
  20. 'moke-20211219181327.png'
  21. )
  22. "
  23. :alt="cardData?.title"
  24. />
  25. </div>
  26. </div>
  27. <template #action>
  28. <n-space class="list-footer" justify="space-between">
  29. <n-text>
  30. {{ cardData?.title || '' }}
  31. </n-text>
  32. <!-- 工具 -->
  33. <n-space>
  34. <n-text>
  35. <n-badge
  36. class="animation-twinkle"
  37. dot
  38. :color="cardData?.release ? '#34c749' : '#fcbc40'"
  39. />
  40. {{ cardData?.release ? '已发布' : '未发布' }}
  41. </n-text>
  42. <template v-for="item in fnBtnList" :key="item.key">
  43. <n-tooltip placement="bottom" trigger="hover">
  44. <template #trigger>
  45. <n-button size="small">
  46. <template #icon>
  47. <component :is="item.icon" />
  48. </template>
  49. </n-button>
  50. </template>
  51. <span> {{ item.label }}</span>
  52. </n-tooltip>
  53. </template>
  54. </n-space>
  55. <!-- end -->
  56. </n-space>
  57. </template>
  58. </n-card>
  59. </slot>
  60. </n-modal>
  61. </template>
  62. <script setup lang="ts">
  63. import { renderIcon, requireUrl, requireFallbackImg } from '@/utils'
  64. import { icon } from '@/plugins'
  65. import { AppleControlBtn } from '@/components/AppleControlBtn'
  66. const { HammerIcon } = icon.ionicons5
  67. const emit = defineEmits(['close'])
  68. const props = defineProps({
  69. modalShow: Boolean,
  70. cardData: Object
  71. })
  72. const handleSelect = (key: string) => {
  73. console.log(key)
  74. }
  75. const fnBtnList = [
  76. {
  77. label: '编辑',
  78. key: 'edit',
  79. icon: renderIcon(HammerIcon)
  80. }
  81. ]
  82. // 放大处理
  83. const resizeHandle = () => {}
  84. // 关闭对话框
  85. const closeHandle = () => {
  86. emit('close')
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. $padding: 30px;
  91. $contentHeight: calc(80vh);
  92. @include go('modal-card') {
  93. position: relative;
  94. width: 82vw;
  95. .list-content {
  96. margin-top: 20px;
  97. border-radius: $--border-radius-base;
  98. overflow: hidden;
  99. @include background-point('background-point');
  100. @extend .go-point-bg;
  101. &-top {
  102. position: absolute;
  103. top: 10px;
  104. left: 10px;
  105. height: 22px;
  106. }
  107. &-img {
  108. @extend .go-flex-center;
  109. img {
  110. height: $contentHeight;
  111. @extend .go-border-radius;
  112. }
  113. }
  114. }
  115. .list-footer {
  116. line-height: 30px;
  117. }
  118. }
  119. </style>