progressline.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <view class="progressmax" :style="{'background-color': props.backgroundColor}">
  3. <view class="progressnow"
  4. :style="{'background-image': 'linear-gradient(' + props.frontColor + ',' + props.backColor + ')', 'width':props.progress}">
  5. <view class="progressani"></view>
  6. </view>
  7. </view>
  8. </template>
  9. <script setup>
  10. const props = defineProps({
  11. progress: {
  12. type: String,
  13. default: '0'
  14. },
  15. backgroundColor: {
  16. type: String,
  17. default: 'rgba(0, 0, 0, 0.2)'
  18. },
  19. frontColor: {
  20. type: String,
  21. default: '#CDCF5C'
  22. },
  23. backColor: {
  24. type: String,
  25. default: '#EF8835'
  26. },
  27. });
  28. </script>
  29. <style lang="scss" scoped>
  30. .progressmax {
  31. width: 240rpx;
  32. height: 12rpx;
  33. border-radius: 9999px;
  34. // background-color: rgba(0, 0, 0, 0.2);
  35. .progressnow {
  36. // width: 90%;
  37. height: inherit;
  38. border-radius: inherit;
  39. // background-image: linear-gradient(#CDCF5C, #EF8835);
  40. .progressani {
  41. height: inherit;
  42. border-radius: inherit;
  43. background-image: inherit;
  44. animation: progress 2.5s infinite;
  45. }
  46. }
  47. }
  48. @keyframes progress {
  49. 0% {
  50. background: rgba(255, 255, 255, 0.6);
  51. width: 0;
  52. }
  53. 100% {
  54. background: transparent;
  55. width: 100%;
  56. }
  57. }
  58. </style>