<template>
	<view class="event-list">
		<view class="title">
			<text>{{title}}</text>
			<view class="icon-text" @click="handleClick">
				<text class="text">更多</text>
				<u-icon name="arrow-right-double" color="#0043ac" size="18"></u-icon>
			</view>
		</view>
		<view class="list">
			<view class="list-item" v-for="item in showList" :key="item.id">
				<text @click="clickTitle">{{item.title}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"eventList",
		props: {
			title: {
				type: String,
				default: '通知公告'
			},
			list: {
				type: Array,
				default: () => []
			}
		},
		// computed: {
		// 	showList() {
		// 		console.log('6666', this.list)
		// 		return this.list.filter((item, index) => index < 2)
		// 	}
		// },
		watch: {
			list: {
				handler: (val, olVal) => {
					console.log('我变化了', val, olVal)
				},
				deep: true,
				immediate: true
			}
		},
		data() {
			return {
			};
		},
		methods: {
			// 点击更多
			handleClick() {
				this.$emit('checkMore')
			},
			// 点击标题
			clickTitle() {
				console.log('点击标题')
				wx.navigateTo({
					url: '/packageIndex/messageDetail/messageDetail'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.event-list {
	// padding: 0 40rpx;
	.title {
		width: 100%;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		font-size: 36rpx;
		font-weight: 600;
		// padding: 20rpx 20rpx 0 20rpx;
		box-sizing: border-box;
		padding: 32rpx 40rpx;
		.icon-text {
			display: flex;
			flex-direction: row;
			align-items: center;
			font-size: 34rpx;
			font-weight: 400;
			color: #0043ac;
			.text {
				margin-right: 16rpx;
			}
		}
	}
	.list {
		.list-item {
			margin: 32rpx 0;
			padding: 0 40rpx;
		}
	}
}
</style>