We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
quickApp ReferencesQuick AppElementsprogress

progress

Overview

Shows the progress.

Application Scope

Expand

Item

Description

Applicable devices

Mobile phones, tablets, Vision products, and telematics devices

Applicable regions

Global

Subelements

None

Attributes

In addition to general attributes, the attributes listed in the following table are supported.

Expand

Attribute

Type

Default Value

Mandatory

Description

percent

number

0

No

Percentage value of the progress. This attribute is invalid when type is circular. If this attribute is set to a decimal, the value is rounded off to an integer.

type

horizontal | circular

horizontal

No

Type of the progress bar. Its value cannot be modified dynamically.

  • For a horizontal progress bar, the background color is #f0f0f0.
  • For a circular progress bar, the width and height are both 32 pixels by default. If the width and height are different, the smaller value applies to both the width and height.

Styles

The active pseudo-class is supported.

In addition to common styles, the styles listed in the following table are supported.

Expand

Style

Type

Default Value

Mandatory

Description

color

color

#33b4ff or rgb(51, 180, 255)

No

Color of a progress bar.

stroke-width

length

32px

No

Width of a progress bar. This style is invalid when type is circular.

layer-color (1070+)

color

#f0f0f0

No

Background color of a progress bar.

NOTE

To set the width of a progress bar, you are advised to place the progress element into a div element and set the width of div. If you directly set the width for the progress bar, the setting will not take effect.

Events

Common events (excluding swipe) are supported.

Sample Code

Collapse
Word wrap
Dark theme
Copy code
  1. <template>
  2. <div class="container">
  3. <div class="page-title-wrap">
  4. <text class="page-title">{{componentName}}</text>
  5. </div>
  6. <div class="item-container">
  7. <div class="item-content">
  8. <text class="item-title">10% (Default: color #33b4ff, height32px)</text>
  9. <progress class="progress" percent="10" style="layer-color:#09ba07;"></progress>
  10. </div>
  11. <div class="item-content">
  12. <text class="item-title">20%</text>
  13. <progress class="progress" style="color:#09ba07;stroke-width:10px;" percent="20"></progress>
  14. </div>
  15. <div class="item-content">
  16. <text class="item-title">40%</text>
  17. <progress class="progress" style="color:#0faeff;stroke-width:10px;" percent="40"></progress>
  18. </div>
  19. <div class="item-content">
  20. <text class="item-title">60%</text>
  21. <progress class="progress" style="color:#A020F0;stroke-width:10px;" percent="60"></progress>
  22. </div>
  23. <div class="item-content">
  24. <text class="item-title">80%</text>
  25. <progress class="progress" style="color:#f76160;stroke-width:10px;" percent="80"></progress>
  26. </div>
  27. <div class="item-content-circular">
  28. <text class="item-title">Default: width height 32px</text>
  29. <progress class="circular circular_0" style="color:#09ba07" type="circular"></progress>
  30. </div>
  31. <div class="item-content-circular">
  32. <text class="item-title">height 40px</text>
  33. <progress class="circular circular-1" style="color:#09ba07" type="circular"></progress>
  34. </div>
  35. <div class="item-content-circular">
  36. <text class="item-title">height 60px</text>
  37. <progress class="circular circular-2" style="color:#0faeff" type="circular"></progress>
  38. </div>
  39. <div class="item-content-circular">
  40. <text class="item-title">height 80px</text>
  41. <progress class="circular circular-3" style="color:#A020F0" type="circular"></progress>
  42. </div>
  43. <div class="item-content-circular">
  44. <text class="item-title">height 100px</text>
  45. <progress class="circular circular-4" style="color:#f76160" type="circular"></progress>
  46. </div>
  47. </div>
  48. </div>
  49. </template>
  50. <style>
  51. @import '../../../Common/css/common.css';
  52. .item-container {
  53. margin-bottom: 50px;
  54. margin-right: 60px;
  55. margin-left: 60px;
  56. flex-direction: column;
  57. }
  58. .item-content {
  59. margin-bottom: 60px;
  60. flex-direction: column;
  61. }
  62. .item-content-circular {
  63. margin-bottom: 60px;
  64. flex-direction: column;
  65. align-items: center;
  66. }
  67. .progress {
  68. flex: 1;
  69. padding-left: 20px;
  70. padding-right: 20px;
  71. padding-top: 20px;
  72. padding-bottom: 20px;
  73. }
  74. .item-title {
  75. text-align: center;
  76. }
  77. .circular-1 {
  78. width: 40px;
  79. height: 40px;
  80. }
  81. .circular-2 {
  82. width: 60px;
  83. height: 60px;
  84. }
  85. .circular-3 {
  86. width: 80px;
  87. height: 80px;
  88. }
  89. .circular-4 {
  90. width: 100px;
  91. height: 100px;
  92. }
  93. </style>
  94. <script>
  95. export default {
  96. data: {
  97. componentName: 'progress'
  98. },
  99. onInit() {
  100. this.$page.setTitleBar({text: 'progress'})
  101. }
  102. }
  103. </script>

The following figure shows the final effect.

Version Change History

Expand

Version

Date

Description

1070

2019-05-19

Added the layer-color style to set the background color of a progress bar.

1010

2018-06-20

Added the support for the active pseudo-class.

Links

Search in References
Enter a keyword.