<template>
	<view >
		<slot></slot>
		<u-tabbar :border-top="true" active-color="#007AFF" :list="list" :before-switch='beforeSwitch' inactive-color="#000000"></u-tabbar>
	</view>
</template>

<script>
	/**
	 * tabbar 原理  
	 * 点击时自动隐藏原生tabbar
	 * 首次加载会闪屏
	 * list数据建议放到vuex中以便更好维护
	 */

	export default {

	data(){
		return{
			list : [{
				        "pagePath": "/pages/index/index",
				        "iconPath": "",
				        "selectedIconPath": "",
				        "text": "订阅",
				    }, 
					{
					    "pagePath": "/pages/uploadSample/uploadSample",
					 "iconPath": "",
					 "selectedIconPath": "",
						"count": 0,   //0-无角标，任意大于0数字-有角标
						"isDot": true,
					    "text": "上传",
					}, 
					{
					    "pagePath": "/pages/searchInputSample/searchInputSample",
					   "iconPath": "",
					   "selectedIconPath": "",
					    "text": "搜索",
					},
					{
					    "pagePath": "/pages/listSample/listSample",
					   "iconPath": "",
					   "selectedIconPath": "",
					    "text": "列表",
					}
					]
		}
	},
	methods:{
		/**
		 * @param {Object} index
		 * 拦截点击事件
		 */
		beforeSwitch(index){
		return true;
		// 	if(index === 2){
		
		// 	return false;
		// 	}else{
		// 			return true; // 或者根据逻辑返回false
		// 	}
	
		
		}
	}
	}
</script>

<style>
</style>
