steps.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 class="cu-bar bg-white solid-bottom">
  8. <view class="action">
  9. <text class="cuIcon-title text-orange"></text> 基本用法
  10. </view>
  11. <view class="action">
  12. <button class="cu-btn bg-green shadow" @tap="BasicsSteps">下一步</button>
  13. </view>
  14. </view>
  15. <view class="bg-white padding">
  16. <view class="cu-steps">
  17. <view class="cu-item" :class="index>basics?'':'text-red'" v-for="(item,index) in basicsList"
  18. :key="index">
  19. <text :class="'cuIcon-' + item.cuIcon"></text> {{item.name}}
  20. </view>
  21. </view>
  22. </view>
  23. <view class="bg-white padding margin-top-xs">
  24. <view class="cu-steps">
  25. <view class="cu-item" :class="index>basics?'':'text-orange'" v-for="(item,index) in basicsList"
  26. :key="index">
  27. <text :class="index>basics?'cuIcon-title':'cuIcon-' + item.cuIcon"></text> {{item.name}}
  28. </view>
  29. </view>
  30. </view>
  31. <view class="bg-white padding margin-top-xs">
  32. <view class="cu-steps steps-arrow">
  33. <view class="cu-item" :class="index>basics?'':'text-blue'" v-for="(item,index) in basicsList"
  34. :key="index">
  35. <text :class="'cuIcon-' + item.cuIcon"></text> {{item.name}}
  36. </view>
  37. </view>
  38. </view>
  39. <view class="cu-bar bg-white solid-bottom margin-top">
  40. <view class="action">
  41. <text class="cuIcon-title text-orange"></text> 数字完成
  42. </view>
  43. <view class="action">
  44. <button class="cu-btn bg-green shadow" @tap="NumSteps">下一步</button>
  45. </view>
  46. </view>
  47. <view class="bg-white padding">
  48. <view class="cu-steps">
  49. <view class="cu-item" :class="index>num?'':'text-blue'" v-for="(item,index) in numList" :key="index">
  50. <text class="num" :class="index==2?'err':''" :data-index="index + 1"></text> {{item.name}}
  51. </view>
  52. </view>
  53. </view>
  54. <view class="cu-bar bg-white solid-bottom margin-top">
  55. <view class="action">
  56. <text class="cuIcon-title text-orange"></text> 多级显示
  57. </view>
  58. <view class="action">
  59. <button class="cu-btn bg-green shadow" @tap="ScrollSteps">下一步</button>
  60. </view>
  61. </view>
  62. <scroll-view scroll-x class="bg-white padding response cu-steps steps-bottom"
  63. :scroll-into-view="'scroll-' + scroll" scroll-with-animation>
  64. <view class="cu-item padding-lr-xl" :class="index>scroll?'':'text-blue'" v-for="(item,index) in 10"
  65. :key="index" :id="'scroll-' + index">
  66. Level {{index + 1}} <text class="num" :data-index="index + 1"></text>
  67. </view>
  68. </scroll-view>
  69. </view>
  70. </template>
  71. <script>
  72. export default {
  73. data() {
  74. return {
  75. basicsList: [{
  76. cuIcon: 'usefullfill',
  77. name: '开始'
  78. }, {
  79. cuIcon: 'radioboxfill',
  80. name: '等待'
  81. }, {
  82. cuIcon: 'roundclosefill',
  83. name: '错误'
  84. }, {
  85. cuIcon: 'roundcheckfill',
  86. name: '完成'
  87. }, ],
  88. basics: 0,
  89. numList: [{
  90. name: '开始'
  91. }, {
  92. name: '等待'
  93. }, {
  94. name: '错误'
  95. }, {
  96. name: '完成'
  97. }, ],
  98. num: 0,
  99. scroll: 0
  100. };
  101. },
  102. methods: {
  103. BasicsSteps() {
  104. this.basics = this.basics == this.basicsList.length - 1 ? 0 : this.basics + 1
  105. },
  106. NumSteps() {
  107. this.num = this.num == this.numList.length - 1 ? 0 : this.num + 1
  108. },
  109. ScrollSteps() {
  110. this.scroll = this.scroll == 9 ? 0 : this.scroll + 1
  111. }
  112. }
  113. }
  114. </script>
  115. <style>
  116. </style>