<template>
	<u-tabbar :value="currentTab" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true" :activeColor="activeColor" :inactiveColor="inactiveColor"><u-tabbar-item v-for="(v, i) in tabList" :text="v.name" :icon="v.icon" @click="click1(i, v)"></u-tabbar-item></u-tabbar>
</template>
<script>
export default {
	name: "tabbar",
	data() {
		return {
			list: [],
			tab: 0,
		};
	},
	props: {
		// currentTab: {
		// 	type: Number,
		// 	default: 0,
		// },
		inactiveColor: {
			type: String,
			default: "#3c3c3c",
		},
		activeColor: {
			type: String,
			default: "#1989fa",
		},
	},

	mounted() {},
	computed: {
		currentTab: function() {
			return this.$store.state.menu.current;
		},
		tabList: function() {
			return this.$store.state.menu.list;
		},
	},

	methods: {
		// getTabbar() {
		// 	console.log(this.$store.state.menu.list);
		// 	if (!this.$store.state.menu.list.length) {
		// 		this.$store.dispatch("menu/getMenus");
		// 	}
		// },
		click1(index, item) {
			this.$store.commit("menu/setCurrent", index);
			//this.$Router.replaceAll({ path: item.pagePath });
			uni.reLaunch({
				url: item.pagePath,
			});
		},
	},
};
</script>

<style>
.container {
	padding: 20px;
	font-size: 14px;
	line-height: 24px;
}
</style>
