Home WeChat Applet Mini Program Development Interpretation and analysis of WeChat applet components: 6. progress bar

Interpretation and analysis of WeChat applet components: 6. progress bar

Mar 19, 2017 pm 06:34 PM

progress progress barComponent description:

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

The following is the WXML code:

[XML] Plain text view Copy code

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

The following is the JS code:

[JavaScript] Plain text view Copy code

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

The following is the WXSS code:

[CSS] Plain text view Copy code

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

The following is the WXML code:

[XML] Plain text view Copy 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>
Copy after login


The following is the JS code:

[JavaScript] Plain text view Copy code

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

The following is the WXSS code:

[CSS] Plain text view Copy code

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

The following is the WXML code:

[XML] Plain text view Copy 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>
Copy after login

The following is the JS code:

[JavaScript] Plain text view Copy code

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

The following is the WXSS code:

[CSS] Plain text view Copy code

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


progress progress barMain attributes:

##stroke-width Number#6Unit: px, indicating the width of the line displayed by the progress baractive Booleanfalse represents the animation of the progress bar from left to right. The animation stops at the set percentage. If you write the attribute, it will be true

Attributes

Type

Default value

Description

percent float 0 represents a percentage of 0-100
show-info Boolean false means displaying the percentage on the right side of the progress bar. Writing the attribute means true
color Color #09BB07 represents the color of the progress bar, which can be # or a defined color attribute



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

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)