progress.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view>
  3. <page-head :title="title"></page-head>
  4. <view class="uni-padding-wrap uni-common-mt">
  5. <view class="progress-box">
  6. <progress :percent="pgList[0]" show-info stroke-width="3" />
  7. </view>
  8. <view class="progress-box">
  9. <progress :percent="pgList[1]" stroke-width="3" />
  10. <uni-icons type="close" class="progress-cancel" color="#dd524d"></uni-icons>
  11. </view>
  12. <view class="progress-box">
  13. <progress :percent="pgList[2]" stroke-width="3" />
  14. </view>
  15. <view class="progress-box">
  16. <progress :percent="pgList[3]" activeColor="#10AEFF" stroke-width="3" />
  17. </view>
  18. <view class="progress-control">
  19. <button type="primary" @click="setProgress">设置进度</button>
  20. <button type="warn" @click="clearProgress">清除进度</button>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import uniIcons from '@/components/uni-icons/uni-icons.vue'
  27. export default {
  28. data() {
  29. return {
  30. title: 'progress',
  31. pgList: [0, 0, 0, 0]
  32. }
  33. },
  34. components: {
  35. uniIcons
  36. },
  37. methods: {
  38. setProgress() {
  39. this.pgList = [20, 40, 60, 80]
  40. },
  41. clearProgress() {
  42. this.pgList = [0, 0, 0, 0]
  43. }
  44. }
  45. }
  46. </script>
  47. <style>
  48. .progress-box {
  49. display: flex;
  50. height: 50rpx;
  51. margin-bottom: 60rpx;
  52. }
  53. .uni-icon {
  54. line-height: 1.5;
  55. }
  56. .progress-cancel {
  57. margin-left: 40rpx;
  58. }
  59. .progress-control button{
  60. margin-top: 20rpx;
  61. }
  62. </style>