tabbar.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <script setup lang="ts">
  2. import router from '@/router'
  3. defineProps({
  4. active: {
  5. type: Number,
  6. default: 0,
  7. },
  8. })
  9. const tabList = reactive([
  10. { title: '首页', icon: '', path: 'film-index' },
  11. { title: '电影/影院', icon: '', path: 'film-movie' },
  12. { title: '订单', icon: '', path: 'film-order' },
  13. ])
  14. function handleItem(name: string) {
  15. router.replace({ name })
  16. }
  17. </script>
  18. <template>
  19. <view>
  20. <view class="tabbar">
  21. <view v-for="(item, index) in tabList" :key="index" class="item pt20rpx" @click="handleItem(item.path)">
  22. <i class="iconfont text-44rpx" :class="[active == index ? 'text-[var(--them-color)]' : '']">{{ item.icon }}</i>
  23. <view class="title" :class="[active == index ? 'active' : '']">
  24. {{ item.title }}
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <style lang="scss" scoped>
  31. .tabbar{
  32. display: flex;
  33. justify-content: space-between;
  34. width: 100%;
  35. height: 166rpx;
  36. background: #FFFFFF;
  37. box-shadow: 0rpx -6rpx 12rpx 2rpx rgba(0, 0, 0, 0.09);
  38. border-radius: 32rpx 32rpx 0rpx 0rpx;
  39. position: fixed;
  40. box-sizing: border-box;
  41. bottom: 0;
  42. left: 0;
  43. z-index: 99999;
  44. .item{
  45. flex: 1;
  46. text-align: center;
  47. .img{
  48. width: 44rpx;
  49. height: 44rpx;
  50. margin-top: 20rpx;
  51. }
  52. .title{
  53. font-size: 20rpx;
  54. color: #AAAAAA;
  55. margin-top: 8rpx;
  56. &.active{
  57. color: #222222;
  58. }
  59. }
  60. }
  61. }
  62. </style>