一、wxss尺寸单位rpx

  • rpx(responsive pixel): 可以根据屏幕宽度进行自适应。规定屏幕宽为750rpx。
  • 严格按照XML语法。

二、icon 图标组件

<!--index.wxml-->
<view class="container">
<!--
icon的类型,有效值:
success,
success_no_circle,
info,
warn,
waiting,
cancel,
download,
search,
clear
--> <icon type="success" size="" color='pink'></icon>
<!--
type:icon的类型
size:图标的尺寸
color:图标的颜色
-->
</view>

三、表单组件---button

<!--index.wxml-->
<view class="container">
<button type="primary">这是一个按钮</button> <button type="warn" size="mini">
这是一个按钮</button> <button type="primary" plain='true'>
这是一个按钮</button> <button type="primary" disabled='true'>
这是一个按钮</button> <button loading='true'>
这是一个按钮</button> <button hover-class='btn-bg'>
这是一个按钮</button>
<form>
<input type="password"></input>
<button form-type='reset'>提交</button>
</form> <button open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">授权登录</button>
<button open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="onGotUserInfo">获取用户信息</button> <button hover-class='btn-bg' hover-start-time="" hover-stay-time="">点击态效果</button> <button
send-message-title="分享标题"
send-message-img="分享的单个图片链接"
show-message-card="true"
send-message-path="../index/index?id={{id}}"
class='details_button'
open-type='contact'
plain
>
客服</button> <button open-type="launchApp"
app-parameter="wechat"
binderror="launchAppError"
>打开APP</button> <!--
type:用力控制按钮的类型
primary 绿色
default 白色
warn 红色
size:按钮的大小
default 默认大小
mini 小尺寸
plain:按钮是否镂空,背景颜色透明
true 是
false 否(默认)
disable:禁用按钮
true 是
false 否(默认)
loading:名称前是否需要loading图标
true 是
false 否(默认)
hover-class:绑定按钮按下去的样式
from-type:用于 form 组件,点击分别会触发 form 组件的 submit/reset 事件
submit:提交
reset:重置 open-type:微信开放能力
hover-start-time:按住后多久出现点击态,单位毫秒
hover-stay-time:手指松开后点击态保留时间,单位毫秒
lang:指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。 session-from:会话来源,open-type="contact"时有效
send-message-title:会话内消息卡片标题,open-type="contact"时有效
send-message-path:会话内消息卡片点击跳转小程序路径,open-type="contact"时有效
send-message-img:会话内消息卡片图片,open-type="contact"时有效
show-message-card:是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的 小程序"提示,用户点击后可以快速发送小程序消息,open-type="contact"时有效
bindgetuserinfo:用户点击该按钮时,会返回获取到的用户信息,回调的detail数据与wx.getUserInfo返回的一致, open-type="getUserInfo"时有效
bindcontact:客服消息回调,open-type="contact"时有效
bindgetphonenumber:获取用户手机号回调,open-type=getPhoneNumber时有效
binderror:当使用开放能力时,发生错误的回调,open-type=launchApp时有效
bindopensetting:在打开授权设置页后回调,open-type=openSetting时有效
bindlaunchapp:打开 APP 成功的回调,open-type=launchApp时有效
-->
</view>

  

//index.js
//获取应用实例
Page({
data: {},
bindGetUserInfo: function (e) {
//此处授权得到userInfo
console.log(e.detail.userInfo);
//接下来写业务代码 //最后,记得返回刚才的页面
// wx.navigateBack({
// delta: 1
// })
},
onGotUserInfo:function(e){
console.log(e.detail.errMsg)
console.log(e.detail.userInfo)
console.log(e.detail.rawData)
},
launchAppError:function(e){
console.log(e.detail.errMsg)
} //error 事件参数说明
//invalid scene 调用场景不正确,即此时的小程序不具备打开 APP 的能力。
})

  

/**index.wxss**/
button{margin-top:15rpx;}
.btn-bg{background-color: red;}
input{border:solid 1rpx}

组件--button详解的更多相关文章

  1. [安卓基础] 009.组件Activity详解

    *:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...

  2. 第15.10节 PyQt(Python+Qt)入门学习:Qt Designer可视化设计界面组件与QWidget类相关的组件属性详解

    PyQt学习有阵子了,对章节的骨架基本考虑好了,准备本节就写组件的属性的,结果一是日常工作繁忙,经常晚上还要加班,二是Qt的组件属性很多,只能逐一学习.研究和整理,花的时间有点长,不过终于将可视化设计 ...

  3. 【转】android四大组件--ContentProvider详解

    一.相关ContentProvider概念解析: 1.ContentProvider简介在Android官方指出的Android的数据存储方式总共有五种,分别是:Shared Preferences. ...

  4. 第15.12节PyQt(Python+Qt)入门学习:可视化设计界面组件布局详解

    一.引言 在Qt Designer中,在左边部件栏的提供了界面布局相关部件,如图: 可以看到共包含有四种布局部件,分别是垂直布局(Vertical Layout).水平布局(Horizontal La ...

  5. vue从入门到进阶:组件Component详解(六)

    一.什么是组件? 组件 (Component) 是 Vue.js 最强大的功能之一.组件可以扩展 HTML 元素,封装可重用的代码.在较高层面上,组件是自定义元素,Vue.js 的编译器为它添加特殊功 ...

  6. Vue教程:组件Component详解(六)

    一.什么是组件? 组件 (Component) 是 Vue.js 最强大的功能之一.组件可以扩展 HTML 元素,封装可重用的代码.在较高层面上,组件是自定义元素,Vue.js 的编译器为它添加特殊功 ...

  7. Android四大组件--ContentProvider详解(转)

    一.相关ContentProvider概念解析: 1.ContentProvider简介在Android官方指出的Android的数据存储方式总共有五种,分别是:Shared Preferences. ...

  8. 汉王云名片识别(SM)组件开发详解

    大家好,最近在DeviceOne平台上做了一个汉王云名片识别的功能组件.下面把我开发过程给大家做一个分享,希望可以帮助到大家. 下面我把我的思路给大家讲解一下.   1.找到我要集成的sdk,也就是汉 ...

  9. vue 父子组件通信详解

    这是一篇详细讲解vue父子组件之间通信的文章,初始学习vue的时候,总是搞不清楚几个情况 通过props在父子组件传值时,v-bind:data="data",props接收的到底 ...

随机推荐

  1. Win8Metro(C#)数字图像处理--2.5图像亮度调整

    原文:Win8Metro(C#)数字图像处理--2.5图像亮度调整  2.5图像亮度调整函数 [函数名称] 图像亮度调整函数BrightnessAdjustProcess(WriteableBit ...

  2. UWP-HttpClient

    原文:UWP-HttpClient 基本格式: HttpClient client = new HttpClient(); Uri uri = new Uri(url); HttpResponseMe ...

  3. C#try catch块

    try..catch块的出现是为了异常处理. 格式为:try{...可能发生异常的代码...} catch{...对异常的处理...} finaly{...无论如何都会执行的代码..} 上面的只是一般 ...

  4. Standard C 语言标准函数库速查(彩色的函数列表,十分清楚)

    Standard C 语言标准函数库速查 (Cheat Sheet) wcstombs 函数说明 #include <stdlib.h> size_t mbstowcs(wchar_t * ...

  5. DUI-Windows消息机制要点(34篇)

    [隐藏] 1窗口过程概念 2消息类型 2.1系统定义消息 2.1.1窗口消息 2.1.2命令消息 2.1.3控件通知消息 2.1.4程序定义消息 3消息队列 3.1系统消息队列 3.2线程消息队列 4 ...

  6. 使用VS2012开发基于Office 2013的AddIn程序

    默认VS2012开发的Office Add是基于2010的,如下所示: 如果你机器上安装的Office版本是2013,那么使用VS2012创建的工程是无法运行的,弹出如下的错误: 那么此时怎么办呢?将 ...

  7. Codility---MaxProductOfThree

    Task description A non-empty zero-indexed array A consisting of N integers is given. Theproduct of t ...

  8. MSVBVM60.dll中函数

    本文转载!!! 原文作者:飘云(飘云阁安全论坛) 原文地址:http://www.chinapyg.com/forum.php?mod=viewthread&tid=2225&high ...

  9. Centos7安装Typecho详细教程

    Centos7安装Typecho详细教程   首先搭建LAMPH环境 L linux 服务器(centos或者ubunt) .A Apache .M mysql .P PHP 安装Apache.PHP ...

  10. VUE、微信for动态变量取值(拼接取值)

    item.value是其它循的值如value=[1,2,3] {{'images[arrAy' + item.value+']'}} 那么拼接结果是 {{images[arrAy1]}}, {{ima ...