<template name="navbars">
	<view class="navbar">
		<view class="navbars-content clearfix">
			<view class="nav-item" v-for="(item, index) in navList" :key="index" @click="NavToDetailPage(item, index)">
				<view class="icon"> <image class="icon-image" :src="item.icon" mode="widthFix"></image> </view>
				<view class="name">{{ item.name }}</view>
			</view>
			<view class="nav-item" @click="handleMore" v-if="list.length > 9">
				<view class="icon">
					<image
						class="icon-image"
						src="https://static.caimei365.com/app/img/icon/icon-navs-more@2x.png"
						mode="widthFix"
					></image>
				</view>
				<view class="name">更多</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	name: 'navbars',
	props: {
		list: {
			type: Array
		}
	},
	data() {
		return {
			current: 100,
			navList: []
		}
	},
	created() {
		this.initData(this.list)
	},
	computed: {},
	methods: {
		initData(list) {
			this.navList = list.slice(0, 9)
		},
		handleMore() {
			this.$api.navigateTo(`/pages/goods/channel`)
		},
		NavToDetailPage(pros, index) {
			//跳转
			if (index === 3) {
				let linkPath = 'https://static.caimei365.com/app/caimei-activity-h5/html/2023/activity_02.html'
				this.$api.navigateTo(`/pages/h5/activity/activity?link=${linkPath}&linkId=382`)
			} else {
				/**
				 * 页面跳转
				 **/
				this.$api.FlooryNavigateTo(pros)
			}
		}
	}
}
</script>

<style lang="scss" scoped>
.navbar {
	background: #f7f7f7;
	display: flex;
	align-items: center;
	justify-content: center;
}
.navbars-content {
	width: 94%;
	height: auto;
	box-sizing: border-box;
	padding: 20rpx 0 0 0;
	background-color: #fff;
	border-radius: 16rpx;
	margin-top: 14rpx;
	.nav-item {
		width: 20%;
		height: auto;
		float: left;
		margin-bottom: 30rpx;
		.icon {
			width: 110rpx;
			height: 110rpx;
			margin: 0 auto;
			position: relative;
			.icon-image {
				width: 110rpx;
				height: 110rpx;
				display: block;
			}
			.icon-new {
				width: 44rpx;
				height: 22rpx;
				display: block;
				position: absolute;
				right: 0;
				top: 20rpx;
			}
		}
		.name {
			width: 100%;
			height: 40rpx;
			line-height: 40rpx;
			text-align: center;
			font-size: $font-size-26;
			color: #666666;
		}
		.nav-cell-main {
			width: 100%;
			height: auto;
			position: absolute;
			right: 0;
			.nav-cell {
				width: 164rpx;
				height: auto;
				float: left;
				margin-bottom: 30rpx;
				margin-right: 15.3rpx;
				&:nth-child(4) {
					margin-right: 0;
				}
				&:nth-child(8) {
					margin-right: 0;
				}
				.icon {
					width: 130rpx;
					height: 130rpx;
					margin: 0 auto;
					position: relative;
					.icon-image {
						width: 130rpx;
						height: 130rpx;
						display: block;
					}
					.icon-new {
						width: 44rpx;
						height: 22rpx;
						display: block;
						position: absolute;
						right: 0;
						top: 20rpx;
					}
				}
				.name {
					width: 100%;
					height: 40rpx;
					line-height: 40rpx;
					text-align: center;
					font-size: $font-size-28;
					color: #666666;
				}
			}
		}
	}
}
</style>
