<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 || 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>
import cmsMixins from '@/mixins/cmsMixins.js'
export default {
	mixins: [cmsMixins],
	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) {
			// 采美快捷运营点击量统计
			this.cmsMoudleHits(4, pros.id)
			this.$api.FlooryNavigateTo(pros)
		}
	}
}
</script>

<style lang="scss" scoped>
.navbar {
	background: #f7f7f7;
	display: flex;
	align-items: center;
	justify-content: center;
    width: 100%;
    box-sizing: border-box;
    padding: 0 24rpx;
}
.navbars-content {
	width: 100%;
	height: auto;
	box-sizing: border-box;
	padding: 20rpx 0 0 0;
	background-color: #fff;
	border-radius: 16rpx;
	margin-top: 10rpx;
	.nav-item {
		width: 20%;
		height: auto;
		float: left;
		margin-bottom: 12rpx;
		.icon {
			width: 80rpx;
			height: 80rpx;
			margin: 0 auto;
			position: relative;
			.icon-image {
				width: 80rpx;
				height: 80rpx;
				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-24;
			color: #333333;
		}
	}
}
</style>
