<template>
	<view class="listtopb flexc" >
		<block v-for="(ite,idx) in tablist" :key='idx'>
			<block v-if='ite.limt'>
				<view class="tit" :style="'height:'+height+'rpx'" :class="tabidx==ite.val?'act':''" @click="getTab(ite.val)" v-if="checkPermi([ite.limt])">
					<view class="f16 fw mb6 tits" >{{ite.tit}}</view>
					<view class="f500 f14 txt" v-if="ite.txt||ite.txt==0">{{ite.txt}}</view>
				</view>
			</block>
			<block v-else>
				<view class="tit" :style="'height:'+height+'rpx'" :class="tabidx==ite.val?'act':''" @click="getTab(ite.val)" >
					<view class="f16 fw mb6 tits" >{{ite.tit}}</view>
					<view class="f500 f14 txt" v-if="ite.txt||ite.txt==0">{{ite.txt}}</view>
				</view>
			</block>
			
		</block>
		
	</view>
</template>

<script>
	import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
	export default{
		props:{
			tablist:{
				type: Array,
				default () {
					return []
				}
			},
			height:{
				type: Number,
				default () {
					return 90
				}
			},
			tabidx:{
				type: Number,
				default () {
					return 0
				}
			}
		},
		data(){
			return{
				// tabidxs:0,
			}
		},
		mounted() {
			// this.tabidxs=this.tabidx
		},
		methods:{
			checkPermi, checkRole,
			getTab(idx){
				// this.tabidxs=idx;
				this.$emit('getCheck',idx)
			}
		}
	}
</script>

<style lang="scss">
	.listtopb{
		 .tit{flex: 1;display: flex;flex-direction: column;justify-content: center;position: relative;
			view{text-align: center;}
			.tits{color: #666666;}
			.txt{color: #aaaaaa;}
		 &.act{
			 &::after{content: '';width: 100rpx;height: 6rpx;background:#FE5706 ;position: absolute;left: 50%;margin-left: -50rpx;bottom: 0;}
			.tits{color: #343434;}
			.txt{color: #FE5706;} 
			}
		 }
	}
</style>