Home > WeChat Applet > Mini Program Development > Detailed introduction of WeChat applet button component

Detailed introduction of WeChat applet button component

高洛峰
Release: 2017-03-06 10:27:44
Original
2316 people have browsed it

Detailed introduction of WeChat applet button component

Button button is one of the most common components.

Main attributes:

Detailed introduction of WeChat applet button component

##wxml

<!--按钮默认样式,点击事件-->
<button type="defaule" bindtap="clickButton">Defalut</button>

<!--原始颜色,不可点击状态, 正在加载状态-->
<button type="primary" disabled="true" loading="true">Primary</button>

<button type="warn">warn</button>
Copy after login

js

Page({
 data:{
 // text:"这是一个页面"
 },

 /**
 * button点击事件监听
 */
 clickButton: function(e) {
  //打印所有关于点击对象的信息
  console.log(e);
 },
 onLoad:function(options){
 // 页面初始化 options为页面跳转所带来的参数
 },
 onReady:function(){
 // 页面渲染完成
 },
 onShow:function(){
 // 页面显示
 },
 onHide:function(){
 // 页面隐藏
 },
 onUnload:function(){
 // 页面关闭
 }
})
Copy after login


##More details on the WeChat applet button component For related articles, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template