<template>
	<view style="width: 100;height: 100%;background-color: #f6f6f6;padding: 20rpx 30rpx;">
		<view class="list" v-for="item,index in listArray" :key='index' @click="open" :data-index="index">
			<view class="text">
				<view class="title">{{item.title}}</view>
				<view class="type">{{item.type}}</view>
			</view>
			<view class="img">
				<image :src="item.img" class="i" mode="aspectFit"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				listArray: [{
					title: '钢铁是怎样炼成的',
					type: '文章类型',
					img: 'https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/横占位图.png'
				}, {
					title: '成都富婆通讯录',
					type: '文章类型',
					img: 'https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/横占位图.png'
				}, {
					title: '迪迦变身器使用手册',
					type: '文章类型',
					img: 'https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/横占位图.png'
				}, {
					title: '小红书',
					type: '文章类型',
					img: 'https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/横占位图.png'
				}, {
					title: '小黄书',
					type: '文章类型',
					img: 'https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/横占位图.png'
				}, {
					title: '金瓶梅',
					type: '文章类型',
					img: 'https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/横占位图.png'
				}]
			}
		},
		methods: {
			//点击文章
			open(e) {
				console.log(this.listArray[e.currentTarget.dataset.index].title)
				uni.navigateTo({
					url: '/pages/common_tools/collection/collection_details?title=' + this.listArray[e.currentTarget.dataset.index].title
					// url: '/pages/customer/customer-datails?n=' + n
				})
			}
		},

	}
</script>

<style lang="scss">
	//每一条文章
	.list {
		margin-bottom: 20rpx;
		border-radius: 12rpx;
		background-color: #ffffff;
		padding: 25rpx 20rpx;
		display: flex;
		box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.04);

		.text {
			width: 60%;
			height: 165rpx;
			padding-right: 25rpx;

			.title {
				height: 80%;
				font-size: 30rpx;
				font-weight: bold;
				// overflow: hidden; //超出一行文字自动隐藏 
				// text-overflow: ellipsis; //文字隐藏后添加省略号
				// white-space: nowrap; //强制不换行
			}

			.type {
				font-size: 26rpx;
				color: #666666;
				font-weight: 400;
				height: 20%;
				bottom: 0;
			}
		}

		.img {
			width: 40%;
			height: 100%;

			.i {
				width: 272rpx;
				height: 157rpx;
			}
		}
	}
</style>
