nav.vue 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-luohu" :isBack="true">
  4. <block slot="backText">返回</block>
  5. <block slot="content">导航栏</block>
  6. </cu-custom>
  7. <view v-for="(item,index) in 10" :key="index" v-if="index==TabCur" class="bg-grey padding margin text-center">
  8. Tab{{index}}
  9. </view>
  10. <view class="cu-bar bg-white solid-bottom">
  11. <view class="action">
  12. <text class="cuIcon-title text-orange"></text> 默认
  13. </view>
  14. </view>
  15. <scroll-view scroll-x class="bg-white nav" scroll-with-animation :scroll-left="scrollLeft">
  16. <view class="cu-item" :class="index==TabCur?'text-green cur':''" v-for="(item,index) in 10" :key="index"
  17. @tap="tabSelect" :data-id="index">
  18. Tab{{index}}
  19. </view>
  20. </scroll-view>
  21. <view class="cu-bar bg-white margin-top solid-bottom">
  22. <view class="action">
  23. <text class="cuIcon-title text-orange"></text> 居中
  24. </view>
  25. </view>
  26. <scroll-view scroll-x class="bg-white nav text-center">
  27. <view class="cu-item" :class="index==TabCur?'text-blue cur':''" v-for="(item,index) in 3" :key="index"
  28. @tap="tabSelect" :data-id="index">
  29. Tab{{index}}
  30. </view>
  31. </scroll-view>
  32. <view class="cu-bar bg-white margin-top solid-bottom">
  33. <view class="action">
  34. <text class="cuIcon-title text-orange"></text> 平分
  35. </view>
  36. </view>
  37. <scroll-view scroll-x class="bg-white nav">
  38. <view class="flex text-center">
  39. <view class="cu-item flex-sub" :class="index==TabCur?'text-orange cur':''" v-for="(item,index) in 4"
  40. :key="index" @tap="tabSelect" :data-id="index">
  41. Tab{{index}}
  42. </view>
  43. </view>
  44. </scroll-view>
  45. <view class="cu-bar bg-white margin-top solid-bottom">
  46. <view class="action">
  47. <text class="cuIcon-title text-orange"></text> 背景
  48. </view>
  49. </view>
  50. <scroll-view scroll-x class="bg-red nav text-center">
  51. <view class="cu-item" :class="index==TabCur?'text-white cur':''" v-for="(item,index) in 3" :key="index"
  52. @tap="tabSelect" :data-id="index">
  53. Tab{{index}}
  54. </view>
  55. </scroll-view>
  56. <view class="cu-bar bg-white margin-top solid-bottom">
  57. <view class="action">
  58. <text class="cuIcon-title text-orange"></text> 图标
  59. </view>
  60. </view>
  61. <scroll-view scroll-x class="bg-green nav text-center">
  62. <view class="cu-item" :class="0==TabCur?'text-white cur':''" @tap="tabSelect" data-id="0">
  63. <text class="cuIcon-camerafill"></text> 数码
  64. </view>
  65. <view class="cu-item" :class="1==TabCur?'text-white cur':''" @tap="tabSelect" data-id="1">
  66. <text class="cuIcon-upstagefill"></text> 排行榜
  67. </view>
  68. <view class="cu-item" :class="2==TabCur?'text-white cur':''" @tap="tabSelect" data-id="2">
  69. <text class="cuIcon-clothesfill"></text> 皮肤
  70. </view>
  71. </scroll-view>
  72. </view>
  73. </template>
  74. <script>
  75. export default {
  76. data() {
  77. return {
  78. TabCur: 0,
  79. scrollLeft: 0
  80. };
  81. },
  82. methods: {
  83. tabSelect(e) {
  84. this.TabCur = e.currentTarget.dataset.id;
  85. this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
  86. }
  87. }
  88. }
  89. </script>
  90. <style>
  91. </style>