index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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, index) in actions" :key="index">
  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 } 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. import { List } from 'ant-design-vue';
  62. export default defineComponent({
  63. components: {
  64. Icon,
  65. Tag,
  66. BasicForm,
  67. PageWrapper,
  68. [List.name]: List,
  69. [List.Item.name]: List.Item,
  70. AListItemMeta: List.Item.Meta,
  71. },
  72. setup() {
  73. return {
  74. prefixCls: 'list-search',
  75. list: searchList,
  76. actions,
  77. schemas,
  78. };
  79. },
  80. });
  81. </script>
  82. <style lang="less" scoped>
  83. .list-search {
  84. &__header {
  85. &-form {
  86. margin-bottom: -16px;
  87. }
  88. }
  89. &__container {
  90. padding: 12px;
  91. background-color: @component-background;
  92. }
  93. &__title {
  94. margin-bottom: 12px;
  95. font-size: 18px;
  96. }
  97. &__content {
  98. color: @text-color-secondary;
  99. }
  100. &__action {
  101. margin-top: 10px;
  102. &-item {
  103. display: inline-block;
  104. padding: 0 16px;
  105. color: @text-color-secondary;
  106. &:nth-child(1) {
  107. padding-left: 0;
  108. }
  109. &:nth-child(1),
  110. &:nth-child(2) {
  111. border-right: 1px solid @border-color-base;
  112. }
  113. }
  114. &-icon {
  115. margin-right: 3px;
  116. }
  117. }
  118. &__time {
  119. position: absolute;
  120. right: 20px;
  121. color: rgba(0, 0, 0, 0.45);
  122. }
  123. }
  124. </style>