<template>
	<view class="content">
		<view class="container">
			<view class="star" v-if="tabIndex==1">
				<view class="item">
					<zhcx-star key="star" />
					<text>默认</text>
				</view>
				<view class="item">
					<zhcx-star star="4.2" key="star-level" />
					<text>自定义等级</text>
				</view>
				<view class="item">
					<zhcx-star key="star-color" star="5"  color="orange" />
					<text>自定义颜色</text>
				</view>		
				<view class="item">
					<zhcx-star key="star-icon" star="2.5" icon="zhcx-icon-aixin" />
					<text>自定义图标</text>
				</view>					
				<view class="item">
					<zhcx-star star="4.4" color="#3384ff" :disable="false" @check="changeStar"/>
					<text>可点击</text>
				</view>	
				<view class="item">
					<zhcx-star star="3" color="red" :disable="false" @check="changeStar"/>
					<text>红星打分可点击</text>
				</view>							
			</view>
			<view class="star" v-if="tabIndex==2">
				<zhcx-icon />
			</view>
			<view class="more" v-if="tabIndex==3">
				<text>还没写</text>
				<view class="accordion-content">
					<accordion>
<!-- 						<view class="item" slot="item">
							<p>112</p>
						</view> -->
					</accordion>				
				</view>
			</view>		
		</view>
		<view class="tabBar">
			<view class="item" v-for="item in tabBar" @click="changeTab(item.id)" :key="item.id" :class="tabIndex===item.id?'active':''">
				<!-- <text>icon</text> -->
				<text class="name">{{item.name}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import zhcxStar from '@/components/Star'
	import zhcxIcon from '@/components/Icon'
	import accordion from '@/components/Accordion'
	
	export default{
		name:"zhcx-componts",
		data:()=>{
			return{
				navTitle:"组件",
				tabIndex:"1",
				tabBar:[
					{
						id:"1",
						icon:"",
						name:"评分",
						path:""
					},
					{
						id:"2",
						icon:"",
						name:"图标",
						path:""
					},
					{
						id:"3",
						icon:"",
						name:"更多",
						path:""
					}									
				]
			}
		},
		components:{
			zhcxStar,zhcxIcon,accordion
		},	
		methods:{
			changeTab(index){
				this.tabIndex=index;
				var title=this.tabBar[index-1].name;
				uni.setNavigationBarTitle({
				  title
				})			
			},
			changeStar(options){
				let {checked,star,index}=options;
				console.log({
					checked,star,index
				})
			}			
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		.container{
			padding-bottom:100upx ;
			.star{
				.item{
					padding: 10upx 20upx;
					display: flex;
					justify-content: space-between;
					align-items: center;
				}
			}
		}
		.tabBar{
			width: 100%;
			height: 100upx;						
			position: fixed;
			background-color: #fff;
			left: 0;
			bottom: 0;
			border-top: 1px solid #dadada;
			display: flex;
			justify-content: space-around;
			align-items: center;
			.item{
				width: 25%;	
				height: 100upx;
				float: left;
				text-align: center;
				display: flex;
				justify-content: center;
				align-items: center;
				flex-direction: column;
				&.active{
					color: #3384ff;
				}
				.icon{
					
				}
				.name{
					
				}
			}
		}
	}
	.accordion-content{
		.item{
			width: 80%;
			height: 100vh;
			background-color: #fff;
		}
	}
</style>
