index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <PageWrapper :class="prefixCls" title="搜索列表">
  3. <template #headerContent>
  4. <BasicForm
  5. :class="`${prefixCls}__header-form`"
  6. :labelWidth="100"
  7. :schemas="schemas"
  8. :showActionButtonGroup="false"
  9. />
  10. </template>
  11. <div :class="`${prefixCls}__container`">
  12. <a-list>
  13. <template v-for="item in list" :key="item.id">
  14. <a-list-item>
  15. <a-list-item-meta>
  16. <template #description>
  17. <div :class="`${prefixCls}__content`">
  18. {{ item.content }}
  19. </div>
  20. <div :class="`${prefixCls}__action`">
  21. <template v-for="action in actions" :key="action.icon">
  22. <div :class="`${prefixCls}__action-item`">
  23. <Icon
  24. v-if="action.icon"
  25. :class="`${prefixCls}__action-icon`"
  26. :icon="action.icon"
  27. :color="action.color"
  28. />
  29. {{ action.text }}
  30. </div>
  31. </template>
  32. <span :class="`${prefixCls}__time`">{{ item.time }}</span>
  33. </div>
  34. </template>
  35. <template #title>
  36. <p :class="`${prefixCls}__title`">
  37. {{ item.title }}
  38. </p>
  39. <div>
  40. <template v-for="tag in item.description" :key="tag">
  41. <Tag class="mb-2">
  42. {{ tag }}
  43. </Tag>
  44. </template>
  45. </div>
  46. </template>
  47. </a-list-item-meta>
  48. </a-list-item>
  49. </template>
  50. </a-list>
  51. </div>
  52. </PageWrapper>
  53. </template>
  54. <script lang="ts">
  55. import { Tag, List } from 'ant-design-vue';
  56. import { defineComponent } from 'vue';
  57. import { Icon } from '/@/components/Icon/index';
  58. import { BasicForm } from '/@/components/Form/index';
  59. import { actions, searchList, schemas } from './data';
  60. import { PageWrapper } from '/@/components/Page';
  61. export default defineComponent({
  62. components: {
  63. Icon,
  64. Tag,
  65. BasicForm,
  66. PageWrapper,
  67. [List.name]: List,
  68. [List.Item.name]: List.Item,
  69. AListItemMeta: List.Item.Meta,
  70. },
  71. setup() {
  72. return {
  73. prefixCls: 'list-search',
  74. list: searchList,
  75. actions,
  76. schemas,
  77. };
  78. },
  79. });
  80. </script>
  81. <style lang="less" scoped>
  82. .list-search {
  83. &__header {
  84. &-form {
  85. margin-bottom: -16px;
  86. }
  87. }
  88. &__container {
  89. padding: 12px;
  90. background-color: @component-background;
  91. }
  92. &__title {
  93. margin-bottom: 12px;
  94. font-size: 18px;
  95. }
  96. &__content {
  97. color: @text-color-secondary;
  98. }
  99. &__action {
  100. margin-top: 10px;
  101. &-item {
  102. display: inline-block;
  103. padding: 0 16px;
  104. color: @text-color-secondary;
  105. &:nth-child(1) {
  106. padding-left: 0;
  107. }
  108. &:nth-child(1),
  109. &:nth-child(2) {
  110. border-right: 1px solid @border-color-base;
  111. }
  112. }
  113. &-icon {
  114. margin-right: 3px;
  115. }
  116. }
  117. &__time {
  118. position: absolute;
  119. right: 20px;
  120. color: rgb(0 0 0 / 45%);
  121. }
  122. }
  123. </style>