<template>
	<view class="fe-bottom-nav">
		<view
			v-for="item in items"
			:key="item.key"
			class="fe-bottom-nav__item"
			:class="{ 'fe-bottom-nav__item--active': current === item.key }"
			@tap="go(item)"
		>
			<text class="fe-bottom-nav__icon">{{ item.icon }}</text>
			<text>{{ item.label }}</text>
		</view>
	</view>
</template>

<script>
export default {
	name: 'FeBottomNav',
	props: {
		current: { type: String, default: 'home' }
	},
	data() {
		return {
			items: [
				{ key: 'home', label: '首页', icon: '🏠', url: '/packageA/home/index' },
				{ key: 'mine', label: '我的', icon: '👤', url: '/packageA/worker/profile' }
			]
		}
	},
	methods: {
		go(item) {
			if (item.key === this.current) return
			uni.reLaunch({ url: item.url })
		}
	}
}
</script>
