progress.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-gradual-blue" :isBack="true"><block slot="backText">返回</block><block slot="content">进度条</block></cu-custom>
  4. <view class="cu-bar bg-white solid-bottom">
  5. <view class="action">
  6. <text class="cuIcon-title text-blue"></text>进度条形状
  7. </view>
  8. </view>
  9. <view class="padding bg-white">
  10. <view class="cu-progress">
  11. <view class="bg-red" :style="[{ width:loading?'61.8%':''}]">61.8%</view>
  12. </view>
  13. <view class="cu-progress radius margin-top">
  14. <view class="bg-red" :style="[{ width:loading?'61.8%':''}]">61.8%</view>
  15. </view>
  16. <view class="cu-progress round margin-top">
  17. <view class="bg-red" :style="[{ width:loading?'61.8%':''}]">61.8%</view>
  18. </view>
  19. </view>
  20. <view class="cu-bar bg-white solid-bottom margin-top">
  21. <view class="action">
  22. <text class="cuIcon-title text-blue"></text>进度条尺寸
  23. </view>
  24. </view>
  25. <view class="padding bg-white">
  26. <view class="cu-progress round">
  27. <view class="bg-red" :style="[{ width:loading?'61.8%':''}]"></view>
  28. </view>
  29. <view class="cu-progress round margin-top sm">
  30. <view class="bg-red" :style="[{ width:loading?'61.8%':''}]"></view>
  31. </view>
  32. <view class="cu-progress round margin-top xs">
  33. <view class="bg-red" :style="[{ width:loading?'61.8%':''}]"></view>
  34. </view>
  35. </view>
  36. <view class="cu-bar bg-white solid-bottom margin-top" @tap="showModal" data-target="ColorModal">
  37. <view class="action">
  38. <text class="cuIcon-title text-blue"></text>进度条颜色
  39. </view>
  40. <view class="action">
  41. <view class="padding solid radius shadow-blur" :class="'bg-' + color"></view>
  42. </view>
  43. </view>
  44. <view class="padding" :class="color=='white'?'bg-grey':'bg-white'">
  45. <view class="cu-progress round">
  46. <view :class="'bg-' + color" :style="[{ width:loading?'61.8%':''}]"></view>
  47. </view>
  48. </view>
  49. <view class="cu-bar bg-white solid-bottom margin-top">
  50. <view class="action">
  51. <text class="cuIcon-title text-blue"></text>进度条条纹
  52. </view>
  53. <switch class="margin-right-sm" :class="active?'checked':''" @change="SetActive"></switch>
  54. </view>
  55. <view class="padding bg-white">
  56. <view class="cu-progress round sm striped" :class="active?'active':''">
  57. <view class="bg-green" :style="[{ width:loading?'60%':''}]"></view>
  58. </view>
  59. <view class="cu-progress round sm margin-top-sm striped" :class="active?'active':''">
  60. <view class="bg-black" :style="[{ width:loading?'40%':''}]"></view>
  61. </view>
  62. </view>
  63. <view class="cu-bar bg-white solid-bottom margin-top">
  64. <view class="action">
  65. <text class="cuIcon-title text-blue"></text>进度条比例
  66. </view>
  67. </view>
  68. <view class="padding bg-white">
  69. <view class="cu-progress radius striped active">
  70. <view class="bg-red" :style="[{ width:loading?'30%':''}]">30%</view>
  71. <view class="bg-olive" :style="[{ width:loading?'45%':''}]">45%</view>
  72. <view class="bg-cyan" :style="[{ width:loading?'25%':''}]">25%</view>
  73. </view>
  74. </view>
  75. <view class="cu-bar bg-white solid-bottom margin-top">
  76. <view class="action">
  77. <text class="cuIcon-title text-blue"></text>进度条布局
  78. </view>
  79. </view>
  80. <view class="padding bg-white ">
  81. <view class="flex">
  82. <view class="cu-progress round">
  83. <view class="bg-green" :style="[{ width:loading?'100%':''}]"></view>
  84. </view>
  85. <text class="cuIcon-roundcheckfill text-green margin-left-sm"></text>
  86. </view>
  87. <view class="flex margin-top">
  88. <view class="cu-progress round">
  89. <view class="bg-green" :style="[{ width:loading?'80%':''}]"></view>
  90. </view>
  91. <text class="margin-left">80%</text>
  92. </view>
  93. </view>
  94. <view class="cu-modal" :class="modalName=='ColorModal'?'show':''">
  95. <view class="cu-dialog">
  96. <view class="cu-bar justify-end solid-bottom">
  97. <view class="content">选择颜色</view>
  98. <view class="action" @tap="hideModal">
  99. <text class="cuIcon-close text-red"></text>
  100. </view>
  101. </view>
  102. <view class="grid col-5 padding">
  103. <view class="padding-xs" v-for="(item,index) in ColorList" :key="index" @tap="SetColor" :data-color="item.name" v-if="item.name!='gray' && item.name!='white'">
  104. <view class="padding-tb radius" :class="'bg-' + item.name"> {{item.title}} </view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. </template>
  111. <script>
  112. export default {
  113. data() {
  114. return {
  115. ColorList: this.ColorList,
  116. color: 'red',
  117. loading: false,
  118. modalName: '',
  119. active: false
  120. };
  121. },
  122. onLoad: function() {
  123. let that = this;
  124. setTimeout(function() {
  125. that.loading = true
  126. }, 500)
  127. },
  128. methods: {
  129. showModal(e) {
  130. this.modalName = e.currentTarget.dataset.target
  131. },
  132. hideModal(e) {
  133. this.modalName = null
  134. },
  135. SetColor(e) {
  136. this.color = e.currentTarget.dataset.color;
  137. this.modalName = null
  138. },
  139. SetActive(e) {
  140. this.active = e.detail.value
  141. },
  142. }
  143. }
  144. </script>
  145. <style>
  146. </style>