index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view class="home">
  3. <TopCard :info="info" />
  4. <!-- tab导航栏 -->
  5. <view class="tabs">
  6. <view v-for="(item, index) in navList" :key="index" class="tab" :class="{'is-active': tabCurId === item.id}"
  7. @click="tabClick(index)">
  8. {{item.text}}
  9. </view>
  10. </view>
  11. <swiper :current="tabCurId" class="swiper-box" duration="300" @change="onChangeTab">
  12. <swiper-item class="tab-content" v-for="(_tabItem,tabIndex) in navList" :key="tabIndex">
  13. <CfStatus v-if="tabCurId==0" />
  14. <CfLogistics v-if="tabCurId==1" />
  15. <CfContent v-if="tabCurId==2" />
  16. </swiper-item>
  17. </swiper>
  18. </view>
  19. </template>
  20. <script lang="ts" setup>
  21. import { ref, nextTick, onMounted } from 'vue'
  22. import TopCard from './TopCard.vue'
  23. import CfStatus from './CfStatus.vue'
  24. import CfLogistics from './CfLogistics.vue'
  25. import CfContent from './CfContent.vue'
  26. const topCardRef = ref()
  27. const info = ref({
  28. name: '陈*丽',
  29. addr: '成都市大竹林街道*************',
  30. sex: '女',
  31. text: '近三个月就诊记录',
  32. idCard: '************** 9253',
  33. date: '2024-04-22'
  34. })
  35. const tabCurId = ref(2)//当前tab选中Id
  36. // const loaded = ref(false)
  37. // const status = ref('loading')
  38. // const loadText = ref('数据加载中...')
  39. const navList = ref([{
  40. id: 0,
  41. text: '处方状态',
  42. },
  43. {
  44. id: 1,
  45. text: '物流信息',
  46. },
  47. {
  48. id: 2,
  49. text: '处方内容',
  50. },
  51. {
  52. id: 3,
  53. text: '处方评价',
  54. }
  55. ])
  56. const swiperBoxStyle = () => {
  57. let _h = `calc(100% - 72rpx - ${topCardRef.value?.offsetHeight})`;
  58. console.log("_h", _h)
  59. return {
  60. height: '200px',
  61. };
  62. };
  63. //顶部tab点击
  64. const tabClick = (idx : number) => {
  65. tabCurId.value = idx;
  66. }
  67. //滑动标签页
  68. const onChangeTab = (e) => {
  69. let _inx = e.detail.current;
  70. tabClick(_inx);
  71. }
  72. onMounted(() => {
  73. })
  74. </script>
  75. <style lang="scss" scoped>
  76. .home {
  77. display: flex;
  78. flex-direction: column;
  79. height: 100%;
  80. .tabs {
  81. margin: $uni-spacing-row-s4 0 $uni-spacing-row-s3;
  82. height: 88rpx;
  83. background-color: #fff;
  84. padding: 0 24rpx;
  85. @include flex-between;
  86. .tab {
  87. height: 100%;
  88. @include flex-center;
  89. &.is-active {
  90. color: $uni-color-primary;
  91. position: relative;
  92. &::after {
  93. content: '';
  94. position: absolute;
  95. bottom: 0;
  96. left: 0;
  97. background: $uni-color-primary;
  98. width: 100%;
  99. height: 4rpx;
  100. }
  101. }
  102. }
  103. }
  104. .swiper-box {
  105. flex: 1;
  106. .tab-content {
  107. :deep(.pub-loading) {
  108. height: 100%;
  109. }
  110. }
  111. }
  112. }
  113. </style>