<template>
	<view class="classify">
		<view class="classify-li" v-for="(item, index) in list" :key="index" @click="downLoad(item.link)">
			<image class="classify-li__img" :src="url+item.imgPath" alt=""></image>
			<view class="classify-li__text">
				{{ item.text }}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'Classify1',
		props: {
			list: {
				type: Array,
				default: () => []
			},
			url: {
				type: String,
			}
		},
		data() {
			return {
				baseURL: uni.$BASE_URL
			}
		},
		methods: {
			// 打开自定义链接
			openCustomLink(link = '') {
				console.log(`link: ${link}`)
			},
			downLoad(item) {
				if (item) {
					let url = encodeURIComponent(item)
					uni.navigateTo({
						url: '../../pages/home/myWebView?url=' + url
					})
				}
			},
		}
	}
</script>

<style scoped lang="scss">
	.classify {
		display: flex;
		justify-content: flex-start;
		flex-wrap: wrap;
		padding: 14upx 24upx 8rpx;

		.classify-li {
			flex: 0 0 20%;
			font-size: 24upx;

			&__img {
				display: block;
				width: 98upx;
				height: 98upx;
				margin: auto;
			}

			&__text {
				display: block;
				color: #5a5a5a;
				text-align: center;
				margin: 8upx 0 14upx 0;
			}
		}
	}
</style>
