vue使用vant的van-tabs+tag在選項卡展示該內容有幾條的提示


1.直接寫用v-if判斷下標展示,會滾動。pass!

2.定位,各種定位,相對各種父元素各種定位,還是會滾,因為tab內容一定滾動,pass

3.手寫選項卡+v-if判斷,這肯定可行,但本着能用ui組件絕不手寫代碼的原則,pass!

4.插槽試試,沒用過slot,但‘自定義標簽’有這個template寫法,改了改,可行。

 

<van-tabs v-if="activeAll==1" v-model="bactive" sticky 
      <van-tab v-for="(item,index) in list" :key="index">
        //在下標為3的tab標題上展示這個tag(信息的個數或者提示)
         <template #title> {{item}}<van-tag v-if="(index==3)" class="tipsNum" round type="danger" sixe='medium'>{{tipsNum}}</van-tag></template>
         <BIntime v-show="index==0"></BIntime>
         <BResult v-show="index==1"></BResult>
         <BProgress v-show="index==2"></BProgress>
         <BFocus v-show="index==3"></BFocus>
      </van-tab>
    </van-tabs>
data(){
      return{
        list:['即時','賽果','賽程','關注'],
        bactive:0,
        tipsNum:0
      }
    },

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM