<template>
	<view class="pageBg">
		<view class="navBox">
			<view class="nav" v-for="(item,index) in navList" :key="index" @click="changeNav(item)" :class="{active: currentNav==item.id}">{{ item.text }}</view>
		</view>
		<view class="card" v-for="(item,index) in list">
			<commentItem :item="item"/>
		</view>
	</view>
</template>

<script>
	// import commentItem from './commentItem'
	export default {
		// components: { commentItem },
		props: ['list'],
		data() {
			return {
				navList: [
					{text: '全部', id: 1},
					{text: '最新', id: 2},
					{text: '有图', id: 3},
					{text: '有视频', id: 4},
				],
				currentNav: 1,
			}
		},
		methods: {
			changeNav(item) {
				this.currentNav = item.id
				this.$emit('changeNav', item.id)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.pageBg {
		width: 100%;
		min-height: 100vh;
		padding: 0 28rpx;
	  .navBox {
		  padding: 32rpx 0 24rpx 0;
		  display: flex;
	    .nav {
			padding: 10rpx 24rpx;
			height: 60rpx;
			background: rgba(25,137,250,0.1);
			border-radius: 8rpx;
			border: 2rpx solid #1989FA;
			font-size: 28rpx;
			color: $themC;
			margin-right: 20rpx;
			text-align: center;
			&.active {
				color: #fff;
				background: $themC;
			}
	    }
	  }
	
	  .card {
		  width: 100%;
		  padding: 24rpx 28rpx;
		  margin-bottom: 20rpx;
	  }
	}
</style>