1+ <template >
2+ <div >
3+ <lay-block title =" 默认风格的进度条" ></lay-block >
4+ <lay-progress :percentage =" 40" ></lay-progress >
5+ <div style =" margin-top : 15px ; width :300px " >
6+ <lay-progress :percentage =" 70" ></lay-progress >
7+ </div >
8+ <br >
9+ <p >温馨提示:进度条的宽度是100%适配于它的父级元素,如上面的进度条是在一个300px的父容器中。</p >
10+
11+ <lay-block title =" 更多颜色选取" style =" margin-top : 50px ;" ></lay-block >
12+ <lay-progress :percentage =" 20" theme =" red" ></lay-progress >
13+ <br >
14+ <lay-progress :percentage =" 30" theme =" orange" ></lay-progress >
15+ <br >
16+ <lay-progress :percentage =" 40" theme =" green" ></lay-progress >
17+ <br >
18+ <lay-progress :percentage =" 50" theme =" blue" ></lay-progress >
19+ <br >
20+ <lay-progress :percentage =" 60" theme =" cyan" ></lay-progress >
21+
22+
23+ <lay-block title =" 大尺寸进度条" style =" margin-top : 50px ;" ></lay-block >
24+ <lay-progress :percentage =" 20" size =" big" ></lay-progress >
25+ <br >
26+ <lay-progress :percentage =" 35" size =" big" theme =" green" ></lay-progress >
27+ <br >
28+ <lay-progress :percentage =" 75" size =" big" theme =" cyan" ></lay-progress >
29+
30+ <lay-block title =" 显示进度比文本" style =" margin-top : 50px ;" ></lay-block >
31+
32+ <lay-progress :percentage =" 20" :show-text =" true" ></lay-progress >
33+ <br >
34+ <br >
35+ <lay-progress :percentage =" 50" :show-text =" true" text =" 5 / 10" ></lay-progress >
36+ <br >
37+ <br >
38+ <lay-progress :percentage =" 70" size =" big" :show-text =" true" ></lay-progress >
39+ <br >
40+ <p >正如你上述看到的,除了百分数,还有分数,但是这不是计算的,而是自定义文字</p >
41+
42+ <lay-block title =" 动态改变进度" style =" margin-top : 50px ;" ></lay-block >
43+ <lay-progress :percentage =" percentage" theme =" red" size =" big" show-text ></lay-progress >
44+
45+ <div style =" margin : 20px 0 " >
46+ <lay-button @click =" percentage = 50" >设置50%</lay-button >
47+ <lay-button @click =" load" >模拟loading</lay-button >
48+ </div >
49+
50+ </div >
51+ </template >
52+
53+ <script >
54+ let timer = ' '
55+ export default {
56+ name: " Progress" ,
57+ data (){
58+ return {
59+ percentage: 0
60+ }
61+ },
62+ methods: {
63+ load (){
64+ if (timer){
65+ clearInterval (timer)
66+ }
67+ this .percentage = 0
68+
69+ timer = setInterval (() => {
70+ this .percentage += parseInt (Math .random () * 10 + 3 )
71+ if (this .percentage >= 100 ){
72+ this .percentage = 100
73+ clearInterval (timer)
74+ }
75+ }, 500 )
76+ }
77+ }
78+ }
79+ </script >
80+
81+ <style scoped>
82+
83+ </style >
0 commit comments