tabbar.vue 828 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template>
  2. <view>
  3. <uv-tabbar activeColor="#6FB6B8" :value="currentRouter" @change="change" :placeholder="false">
  4. <uv-tabbar-item v-for="(item, index) in list" :key="index" :text="item.text">
  5. <template v-slot:active-icon>
  6. <image class="icon" :src="item.imgUrlActive"></image>
  7. </template>
  8. <template v-slot:inactive-icon>
  9. <image class="icon" :src="item.imgUrl"></image>
  10. </template>
  11. </uv-tabbar-item>
  12. </uv-tabbar>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. props: {
  18. list: {
  19. type: Array
  20. },
  21. currentRouter: {
  22. type: Number,
  23. default: 0
  24. }
  25. },
  26. data() {
  27. return {}
  28. },
  29. methods: {
  30. // 导航栏切换回调
  31. change(e) {
  32. this.$emit('changeRouter', this.list[e].show, this.list[e].text, e)
  33. }
  34. }
  35. }
  36. </script>
  37. <style scoped>
  38. .icon {
  39. width: 40rpx;
  40. height: 40rpx;
  41. }
  42. </style>