Home  >  Article  >  WeChat Applet  >  Interpretation and analysis of the progress bar of WeChat applet component progress

Interpretation and analysis of the progress bar of WeChat applet component progress

高洛峰
高洛峰Original
2018-05-15 11:01:159720browse

progressProgress barComponent description:

The progress bar indicates how far things have been completed, allowing users to visually perceive the execution of things.
The progress bar is a component of the WeChat applet, similar to HTML5's progress bar progress.

##progress progress barComponentThe sample code runs as follows:

Interpretation and analysis of the progress bar of WeChat applet component progress

##The following is W

XMLCode:

<!--index.wxml-->
<view class="content">
    <text class="con-text">问:老司机,啥时候开车?</text>
    <progress class="con-pro" percent="97" show-info/>
</view>

The following is the

JSCode:

Page({
  data:{
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  }
})

The following is the

WXSS code :

.content{
  padding-top: 20px;
}
.con-text{
  display: block;
  padding-bottom: 20px;
}
.con-pro{
  color: cornflowerblue;
}

Interpretation and analysis of the progress bar of WeChat applet component progress

The following is the WXML code:

<!--index.wxml-->
<view class="content">
    <text class="con-text">不展示百分比</text>
    <progress class="con-pro" percent="77"/>
    <text class="con-text">展示百分比(百分比字体样式通过class控制)</text>
    <progress class="con-pro" percent="97" show-info/>
    <text class="con-text">改变进度条线的宽度:15px</text>
    <progress class="con-pro" percent="47" stroke-width="15"/>
    <text class="con-text">改变进度条颜色(#):黑色</text>
    <progress class="con-pro" percent="67" color="#000000"/>
    <text class="con-text">改变进度条颜色(已定义):橘色</text>
    <progress class="con-pro" percent="67" color="orange"/>
    <text class="con-text">几个属性叠加</text>
    <progress class="con-pro" percent="87" color="lightgreen" show-info stroke-width="30"/>
</view>

The following is the JS code:

Page({
  data:{
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  }
})

The following is the WXSS code:

.content{
  padding-top: 20px;
}
.con-text{
  display: block;
  padding-bottom: 10px;
}
.con-pro{
  padding-bottom: 30px;
  color: cornflowerblue;
}

Interpretation and analysis of the progress bar of WeChat applet component progress

The following is the WXML code:

<!--index.wxml-->
<view class="content">
    <text class="con-text">看我开的飞起</text>
    <progress class="con-pro" active percent="87" color="lightgreen" show-info stroke-width="20"/>
</view>

The following is the JS code:

Page({
  data:{
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  }
})

The following is the WXSS code:

.content{
  padding-top: 20px;
}
.con-text{
  display: block;
  padding-bottom: 10px;
}
.con-pro{
  padding-bottom: 30px;
  color: cornflowerblue;
}

Progress progress bar's Main properties:

PropertiesTypeDefault valueDescriptionpercentfloatshow- infocolorstroke-widthactive

0 represents a percentage of 0-100
Boolean false means that the percentage is displayed on the right side of the progress bar. If you write the attribute, it means true
Color #09BB07 represents the color of the progress bar, which can be # or a defined color attribute
Number 6 Unit: px, indicating the line width displayed by the progress bar
Boolean false represents the animation of the progress bar from left to right. The animation stops at the set percentage. Write the attribute to mean true

The above is the detailed content of Interpretation and analysis of the progress bar of WeChat applet component progress. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn