54 lines
1.8 KiB
Vue
54 lines
1.8 KiB
Vue
<template>
|
|
<el-col v-for="(item,index) in data" :key="index" :span="6" class="left mb-6">
|
|
<el-card shadow="hover" :body-style="{ padding: '0px' }" class=" hover:bg-gray-50 cursor-pointer">
|
|
<nuxt-link :to="`/${item.detail}/${item.articleId}.html`">
|
|
<el-image
|
|
:src="item.image"
|
|
fit="cover"
|
|
:lazy="true" class="w-full md:h-[166px] h-[199px] cursor-pointer bg-gray-50"/>
|
|
<div class="flex-1 px-4 py-5 sm:p-6 !p-4">
|
|
<div class="text-gray-700 dark:text-white text-base font-semibold flex flex-col gap-1.5">
|
|
<div class="flex-1 text-xl cursor-pointer flex min-h-[56px]">
|
|
<span v-html="replaceKeywords(item.title)"></span>
|
|
</div>
|
|
</div>
|
|
<div class="button-group flex justify-between items-center mt-3 text-sm">
|
|
<el-space class="flex items-end">
|
|
<div class="text-gray-400 gap-1 flex items-center"><el-icon><View /></el-icon><span>{{ getViews(item) }}</span></div>
|
|
</el-space>
|
|
<div class="text-gray-400">
|
|
{{ dayjs(item.createTime).format('YYYY-MM-DD') }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nuxt-link>
|
|
</el-card>
|
|
</el-col>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { View } from '@element-plus/icons-vue'
|
|
import {getViews} from "~/utils/common";
|
|
import dayjs from "dayjs";
|
|
import type {CmsArticle, CmsArticleParam} from "~/api/cms/cmsArticle/model";
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
data?: CmsArticle[];
|
|
keywords?: string;
|
|
}>(),
|
|
{}
|
|
);
|
|
|
|
const emit = defineEmits<{
|
|
(e: 'done', where: CmsArticleParam): void
|
|
}>()
|
|
|
|
const replaceKeywords = (text: any) => {
|
|
return text.replace(`${props.keywords}`,'<font color=#ff0000>' + props.keywords + '</font>');
|
|
}
|
|
|
|
</script>
|
|
<style scoped lang="less">
|
|
</style>
|