<template> <!-- Tab --> <u-tabbar zIndex="10075" v-model="selectedTabbar" :border="false" inactive-color="#000000" height="50" active-color="#006ECF" :fixed="true" :safeAreaInsetBottom="true" @change="beforeSwitch"> <u-tabbar-item v-for="(item,index) in list" :key="item.text" :text="item.text" :icon="selectedTabbar==index?item.activeIcon:item.icon"></u-tabbar-item> </u-tabbar> </template> <script> export default { data() { return { } }, props: ['selectedTabbar'], computed: { list() { // tabbar List return this.$store.state.list; } }, methods: { //点击tab beforeSwitch(index) { uni.switchTab({ url: this.list[index].pagePath }); return true; } } } </script> <style> </style>