<template>
	<view>
		<view class="line"></view>
		
		<view class="icon_nav">
			<view class="nav_list">
				
				<view class="item" v-for="item in navsList" :key="item.id" @click="go_detail(item.link,item.id)">
					<view class="item_icon">
						<image :src="item.icon"></image>
					</view>
					<view class="item_name">
						<text>{{item.title}}</text>
					</view>
				</view>
				
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		props:[
			"navsList"
		],
		data() {
			return {
				
			};
		},
		methods:{
			go_detail(link,id){
				const href = link + id
				console.log(href)
				
				uni.navigateTo({
					url:"../../i-nav-detail/i-nav-detail",
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						res.eventChannel.emit('acceptDataFromOpenerPage', { href: href })
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.line{
		width: 100%;
		height: 6rpx;
		background-color: #F0F0F0;
	}
	.icon_nav{
		box-sizing: border-box;
		padding-top: 24rpx;
		padding-left: 55rpx;
		padding-right: 55rpx;
		.nav_list{
			overflow: hidden;
			.item{
				float: left;
				width: 160rpx;
				text-align: center;
				margin-bottom: 42rpx;
				.item_icon{
					margin: 0 auto;
					width: 94rpx;
					height: 94rpx;
					image{
						width: 94rpx;
						height: 94rpx;
					}
				}
				.item_name{
					margin-top: 18rpx;
					height: 34rpx;
					font-size: 25rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #455A64;
					line-height: 34rpx;

				}
			}
		}
		
	}
</style>
