tabBar.vue 777 Bytes
Newer Older
zhangcheng committed
1 2
<template>
  <!-- Tab -->
张成 committed
3 4
  <u-tabbar zIndex="10075" v-model="selectedTabbar" :border="false" inactive-color="#000000" height="50"
    active-color="#006ECF" :fixed="true" :safeAreaInsetBottom="true" @change="beforeSwitch">
weijiguang committed
5
    <u-tabbar-item v-for="(item, index) in list" :key="item.text" :text="item.text" 
张成 committed
6 7
      :icon="selectedTabbar == index ? item.activeIcon : item.icon"></u-tabbar-item>
  </u-tabbar>
zhangcheng committed
8 9
</template>
<script>
张成 committed
10

zhangcheng committed
11
export default {
张成 committed
12
  data() {
张成 committed
13
    return {}
张成 committed
14 15 16 17 18 19 20 21 22
  },
  props: ['selectedTabbar'],
  computed: {
    list() {
      // tabbar List
      return this.$store.state.list;
    }
  },
  methods: {
zhangcheng committed
23
    //点击tab
张成 committed
24

zhangcheng committed
25
    beforeSwitch(index) {
张成 committed
26
   
张成 committed
27 28
      uni.switchTab({ url: this.list[index].pagePath });
      return true;
zhangcheng committed
29
    }
张成 committed
30
  }
zhangcheng committed
31 32 33 34 35
}
</script>

<style>
</style>