<template>
	<view   class="page_body" disableScroll>
		<view class="page_container">
			<home ref="home" v-show="tabBarIndex==0" />
			<personal ref="personal" v-show="tabBarIndex==1" />
		</view>
		<tab-bar :tabBarList='tabBarList' v-model="tabBarIndex" />
	</view>
</template>

<script>
	import tool from '../../utils/tool.js'
	import tabBar from "@/components/tabBar/tabBar.vue"
	import home from "../home/index.vue"
	import personal from "../personal/index.vue" 
	export default {
		components: {
			tabBar,
			home,
			personal
		},
		data() {
			return {
				tabBarList: [{
						"text": "首页",
						"selectIndex": 0,
						"iconPath": require('@/static/home.png'),
						"selectedIconPath": require('@/static/select-home.png'),
					},
					{
						"text": "我的",
						"selectIndex": 1,
						"iconPath": require('@/static/Personal.png'),
						"selectedIconPath": require('@/static/select-Personal.png'),
					}
				],
				user: uni.getStorageSync('user'),
				location: null,
				setingMenuData: null,
				tabBarIndex: 0,
				Anticorrosive: null
			}
		},
		watch: {
			tabBarIndex(n, o) {
				console.log('索引改变')
			}
		},
		created() {
			this.init()
		},
		onLoad() {},
		onShow() {
			uni.$emit('onshow','onshow')
		},
		methods: {
			async getPosition(callback) {
				await this.tool.getLocation().then(res => {
					this.location = uni.getStorageSync('location')
				}).catch(err => {});
			},
			 init() {
				this.getSetingMenu(); //获取胶囊数据  
			},
			getSetingMenu() {
				this.setingMenuData = wx.getMenuButtonBoundingClientRect();
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import 'index.scss';
</style>