kTabs.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view class="components">
  3. <view>
  4. <view class="title">常规:</view>
  5. <k-tabs-swiper v-model="current" :tabs="tabs" bgColor="#1EBB81" color="rgba(255,255,255,0.8)"
  6. activeColor="#FFFFFF" fontSize="28rpx" :bold="true" :scroll="true" height="100rpx" lineHeight="10rpx"
  7. @change="changeTab" paddingItem="0 50rpx" />
  8. </view>
  9. <view>
  10. <view class="title">数据为-数组对象:</view>
  11. <k-tabs-swiper v-model="current" :tabs="tabs1" field="name" bgColor="#1EBB81" color="rgba(255,255,255,0.8)"
  12. activeColor="#FFFFFF" fontSize="28rpx" :bold="true" :scroll="true" height="100rpx" lineHeight="0"
  13. @change="changeTab" paddingItem="0 50rpx" />
  14. </view>
  15. <view>
  16. <view class="title">平铺:</view>
  17. <k-tabs-swiper v-model="current" :tabs="tabs2" bgColor="#1EBB81" color="rgba(255,255,255,0.8)"
  18. activeColor="#FFFFFF" fontSize="28rpx" :scroll="false" :bold="true" height="100rpx" @change="changeTab"
  19. paddingItem="0 50rpx" />
  20. </view>
  21. <view>
  22. <view class="title">胶囊:</view>
  23. <k-tabs-swiper v-model="current" :tabs="tabs" :pills="true" bgColor="#1EBB81" color="rgba(255,255,255,0.8)"
  24. activeColor="#FFFFFF" fontSize="28rpx" :bold="true" height="100rpx" @change="changeTab"
  25. paddingItem="0 50rpx" />
  26. </view>
  27. <view>
  28. <view class="title">胶囊:</view>
  29. <k-tabs-swiper v-model="current" :tabs="tabs" :pills="true" bgColor="#1EBB81" color="rgba(255,255,255,0.8)"
  30. activeColor="#FFFFFF" fontSize="28rpx" pillsColor="red" :bold="true" pillsBorderRadius="100rpx"
  31. height="100rpx" :lineScale="0.8" @change="changeTab" paddingItem="0 50rpx" />
  32. </view>
  33. <view>
  34. <view class="title">自定义底部:</view>
  35. <k-tabs-swiper v-model="current" :tabs="tabs" :pills="true" bgColor="#1EBB81" color="rgba(255,255,255,0.8)"
  36. activeColor="#FFFFFF" fontSize="28rpx" pillsColor="red" :bold="true" pillsBorderRadius="100rpx"
  37. height="100rpx" @change="changeTab" paddingItem="0 50rpx" :lineSlot="true">
  38. <image class="line_img" slot="line" src="/static/k-tabs-swiper/img.png" mode="scaleToFill" />
  39. </k-tabs-swiper>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import KTabsSwiper from '../k-tabs-swiper/k-tabs-swiper'
  45. export default {
  46. components: {
  47. KTabsSwiper
  48. },
  49. data() {
  50. return {
  51. current: 0,
  52. tabs: ['新闻', '早报', '军事', '生活', '地区事件', '文化', '军事', '国内', '新闻'],
  53. tabs1: [{
  54. id: 1,
  55. name: '新闻',
  56. }, {
  57. id: 2,
  58. name: '早报',
  59. }, {
  60. id: 1,
  61. name: '军事'
  62. }, {
  63. id: 3,
  64. name: '生活',
  65. }, {
  66. id: 4,
  67. name: '地区事件',
  68. }, {
  69. id: 5,
  70. name: '文化',
  71. }, {
  72. id: 6,
  73. name: '军事',
  74. }, {
  75. id: 7,
  76. name: '国内',
  77. }, {
  78. id: 8,
  79. name: '新闻',
  80. }], //用户测评日志
  81. tabs2: ['全部', '待支付', '进行中', '已完成'], //用户测评日志
  82. }
  83. },
  84. methods: {
  85. changeTab(index) {
  86. console.log("下标", index);
  87. }
  88. },
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. .title {
  93. font-weight: bold;
  94. padding: 16rpx;
  95. }
  96. .line_img {
  97. width: 42rpx;
  98. height: 17rpx;
  99. }
  100. </style>