vue-vben-admin/src/views/demo/page/list/search/index.vue

136 lines
3.3 KiB
Vue
Raw Normal View History

2020-12-02 00:53:00 +08:00
<template>
<PageWrapper :class="prefixCls" title="搜索列表">
<template #headerContent>
2020-12-02 00:53:00 +08:00
<BasicForm
:class="`${prefixCls}__header-form`"
:labelWidth="100"
:schemas="schemas"
:showActionButtonGroup="false"
/>
</template>
2020-12-02 00:53:00 +08:00
<div :class="`${prefixCls}__container`">
<a-list>
<template v-for="item in list" :key="item.id">
<a-list-item>
<a-list-item-meta>
<template #description>
2021-01-28 23:28:50 +08:00
<div :class="`${prefixCls}__content`">
{{ item.content }}
</div>
2020-12-02 00:53:00 +08:00
<div :class="`${prefixCls}__action`">
<template v-for="action in actions" :key="action.icon">
2020-12-02 00:53:00 +08:00
<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>
2021-01-28 23:28:50 +08:00
<p :class="`${prefixCls}__title`">
{{ item.title }}
</p>
2020-12-02 00:53:00 +08:00
<div>
2021-06-17 21:43:53 +08:00
<template v-for="tag in item.description" :key="tag">
2021-01-28 23:28:50 +08:00
<Tag class="mb-2">
{{ tag }}
</Tag>
2020-12-02 00:53:00 +08:00
</template>
</div>
</template>
</a-list-item-meta>
</a-list-item>
</template>
</a-list>
</div>
</PageWrapper>
2020-12-02 00:53:00 +08:00
</template>
<script lang="ts">
import { Tag } from 'ant-design-vue';
import { defineComponent } from 'vue';
import Icon from '/@/components/Icon/index';
import { BasicForm } from '/@/components/Form/index';
import { actions, searchList, schemas } from './data';
import { PageWrapper } from '/@/components/Page';
2021-01-18 23:37:36 +08:00
import { List } from 'ant-design-vue';
2020-12-02 00:53:00 +08:00
export default defineComponent({
2021-01-18 23:37:36 +08:00
components: {
Icon,
Tag,
BasicForm,
PageWrapper,
[List.name]: List,
[List.Item.name]: List.Item,
AListItemMeta: List.Item.Meta,
},
2020-12-02 00:53:00 +08:00
setup() {
return {
prefixCls: 'list-search',
list: searchList,
actions,
schemas,
};
},
});
</script>
<style lang="less" scoped>
.list-search {
&__header {
&-form {
margin-bottom: -16px;
}
}
&__container {
padding: 12px;
2021-04-13 21:43:10 +08:00
background-color: @component-background;
2020-12-02 00:53:00 +08:00
}
&__title {
margin-bottom: 12px;
font-size: 18px;
}
&__content {
2021-04-07 23:14:51 +08:00
color: @text-color-secondary;
2020-12-02 00:53:00 +08:00
}
&__action {
margin-top: 10px;
&-item {
display: inline-block;
padding: 0 16px;
2021-04-07 23:14:51 +08:00
color: @text-color-secondary;
2020-12-02 00:53:00 +08:00
&:nth-child(1) {
padding-left: 0;
}
&:nth-child(1),
&:nth-child(2) {
2021-04-07 23:14:51 +08:00
border-right: 1px solid @border-color-base;
2020-12-02 00:53:00 +08:00
}
}
&-icon {
margin-right: 3px;
}
}
&__time {
position: absolute;
right: 20px;
color: rgba(0, 0, 0, 0.45);
}
}
</style>