<template>
	<view class="list-item-box">
		<img class="list-img" :src="data.cover||defaultImg">
		<view class="list-time-box" :class="{'time-red-box': type == 1}">
			<view class="time-data">{{ formatDate[1] }}</view>
			<view class="time-year">{{formatDate[0]}}</view>
		</view>
		<view class="list-right-box">
			<h1 class="list-name">{{ data.title }}</h1>
			<view class="list-line"></view>
			<view class="list-content" v-html="getStringByHtml3(data.content)">
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive,
		computed
	} from "vue";
	import {
		getStringByHtml3,
		formatDateToYearMonthDay
	} from "@/utils/common.js"
	import default2 from '@/static/images/common/news-bj2.png'
	import default1 from '@/static/images/common/news-bj1.jpg'
	const props = defineProps({
		data: {
			type: Object
		},
		type: {
			type: Number
		}
	})

	const formatDate = computed(() => {
		return formatDateToYearMonthDay(props.data.createTime)
	})

	const defaultImg = computed(() => {
		return props.type == 1 ? default1 : default2
	})
</script>

<style>

</style>