微信小程序(十四)button组件详细介绍

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

微信小程序(十四)button组件详细介绍

顺子_RTFSC   2020-05-15 我要评论

button按钮用的算是最普遍的组件之一。

主要属性:

wxml

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

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

<button type="warn">warn</button>

js

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

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

相关文章:

hello WeApp                      icon组件
Window 
                            text组件                                switch组件
tabBar底部导航                 progress组件                        action-sheet
应用生命周期                    button组件                            modal组件
页面生命周期
                    checkbox组件                       toast组件
模块化详                           form组件详                            loading 组件
数据绑定
                           input 组件                             navigator 组件
View组件                          picker组件                             audio 组件
scroll-view组件                 radio组件                              video组件
swiper组件                        slider组件                              Image组件

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们