index.vue 3.3 KB
Newer Older
陈小婷 已提交
1
<template>
2 3
  <PageWrapper :class="prefixCls" title="搜索列表">
    <template #headerContent>
陈小婷 已提交
4 5 6 7 8 9
      <BasicForm
        :class="`${prefixCls}__header-form`"
        :labelWidth="100"
        :schemas="schemas"
        :showActionButtonGroup="false"
      />
10
    </template>
陈小婷 已提交
11 12 13 14 15 16 17

    <div :class="`${prefixCls}__container`">
      <a-list>
        <template v-for="item in list" :key="item.id">
          <a-list-item>
            <a-list-item-meta>
              <template #description>
V
vben 已提交
18 19 20
                <div :class="`${prefixCls}__content`">
                  {{ item.content }}
                </div>
陈小婷 已提交
21
                <div :class="`${prefixCls}__action`">
22
                  <template v-for="action in actions" :key="action.icon">
陈小婷 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35 36
                    <div :class="`${prefixCls}__action-item`">
                      <Icon
                        v-if="action.icon"
                        :class="`${prefixCls}__action-icon`"
                        :icon="action.icon"
                        :color="action.color"
                      />
                      {{ action.text }}
                    </div>
                  </template>
                  <span :class="`${prefixCls}__time`">{{ item.time }}</span>
                </div>
              </template>
              <template #title>
V
vben 已提交
37 38 39
                <p :class="`${prefixCls}__title`">
                  {{ item.title }}
                </p>
陈小婷 已提交
40
                <div>
V
Vben 已提交
41
                  <template v-for="tag in item.description" :key="tag">
V
vben 已提交
42 43 44
                    <Tag class="mb-2">
                      {{ tag }}
                    </Tag>
陈小婷 已提交
45 46 47 48 49 50 51 52
                  </template>
                </div>
              </template>
            </a-list-item-meta>
          </a-list-item>
        </template>
      </a-list>
    </div>
53
  </PageWrapper>
陈小婷 已提交
54 55
</template>
<script lang="ts">
56
  import { Tag, List } from 'ant-design-vue';
陈小婷 已提交
57
  import { defineComponent } from 'vue';
V
vben 已提交
58
  import { Icon } from '/@/components/Icon/index';
陈小婷 已提交
59 60
  import { BasicForm } from '/@/components/Form/index';
  import { actions, searchList, schemas } from './data';
61
  import { PageWrapper } from '/@/components/Page';
陈小婷 已提交
62 63

  export default defineComponent({
V
vben 已提交
64 65 66 67 68 69 70 71 72
    components: {
      Icon,
      Tag,
      BasicForm,
      PageWrapper,
      [List.name]: List,
      [List.Item.name]: List.Item,
      AListItemMeta: List.Item.Meta,
    },
陈小婷 已提交
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
    setup() {
      return {
        prefixCls: 'list-search',
        list: searchList,
        actions,
        schemas,
      };
    },
  });
</script>
<style lang="less" scoped>
  .list-search {
    &__header {
      &-form {
        margin-bottom: -16px;
      }
    }

    &__container {
      padding: 12px;
V
Vben 已提交
93
      background-color: @component-background;
陈小婷 已提交
94 95 96 97 98 99 100 101
    }

    &__title {
      margin-bottom: 12px;
      font-size: 18px;
    }

    &__content {
V
Vben 已提交
102
      color: @text-color-secondary;
陈小婷 已提交
103 104 105 106 107 108 109 110
    }

    &__action {
      margin-top: 10px;

      &-item {
        display: inline-block;
        padding: 0 16px;
V
Vben 已提交
111
        color: @text-color-secondary;
陈小婷 已提交
112 113 114 115 116 117 118

        &:nth-child(1) {
          padding-left: 0;
        }

        &:nth-child(1),
        &:nth-child(2) {
V
Vben 已提交
119
          border-right: 1px solid @border-color-base;
陈小婷 已提交
120 121 122 123 124 125 126 127 128 129 130
        }
      }

      &-icon {
        margin-right: 3px;
      }
    }

    &__time {
      position: absolute;
      right: 20px;
V
vben 已提交
131
      color: rgb(0 0 0 / 45%);
陈小婷 已提交
132 133 134
    }
  }
</style>