云链智安app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wade-tabbar.vue 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view>
  3. <scroll-view class="tab-bar" scroll-x="true" show-scrollbar="false">
  4. <view class="tab-item" :class="index==curIndex?'active':''" v-for="(item ,index) in tabList" @click="clickNav(index)">
  5. {{item.name}}
  6. </view>
  7. </scroll-view>
  8. <view class="tab-bar-line"></view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. name:"wade-tabbar",
  14. props:{
  15. tabList:{
  16. type:Array,
  17. default(){
  18. return []
  19. }
  20. }
  21. },
  22. data() {
  23. return {
  24. curIndex:0
  25. };
  26. },
  27. methods:{
  28. clickNav(index){
  29. console.log("clickNav")
  30. this.curIndex = index
  31. this.$emit("clickNav",index)
  32. }
  33. }
  34. }
  35. </script>
  36. <style lang="scss" scoped>
  37. .tab-bar{
  38. height: 100rpx;
  39. background: #f7f8fa;
  40. position: fixed;
  41. left:0;
  42. top:var(--window-top);
  43. z-index:10;
  44. white-space: nowrap;
  45. .tab-item{
  46. font-size: 35rpx;
  47. display: inline-block;
  48. line-height: 100rpx;
  49. margin: 0 10rpx;
  50. text-align: center;
  51. width: 100upx;
  52. height: 75upx;
  53. }
  54. .active{
  55. color:#31c27c;
  56. font-weight: 500;
  57. border-bottom: 5rpx solid #31c27c;
  58. }
  59. }
  60. // .tab-bar-line {
  61. // width: 100%;
  62. // height: 2rpx;
  63. // background-color: #aa55ff;
  64. // }
  65. </style>