按钮可以使用a或者
button
标签。wap
上要触发按钮的active
态,必须触发ontouchstart
事件,可以在body
上加上ontouchstart=""
全局触发。
按钮常见的操作场景:确定、取消、警示,分别对应class:weui_btn_primary
、weui_btn_default
、weui_btn_warn
,每种场景都有自己的置灰态weui_btn_disabled
,除此外还有一种镂空按钮weui_btn_plain_xxx
,客户端webview里的按钮尺寸有两类,默认宽度100%
,小型按钮宽度自适应,两边边框与文本间距0.75em
:
<a href="javascript:;" class="weui_btn weui_btn_primary">按钮</a>
<a href="javascript:;" class="weui_btn weui_btn_disabled weui_btn_primary">按钮</a>
<a href="javascript:;" class="weui_btn weui_btn_warn">确认</a>
<a href="javascript:;" class="weui_btn weui_btn_disabled weui_btn_warn">确认</a>
<a href="javascript:;" class="weui_btn weui_btn_default">按钮</a>
<a href="javascript:;" class="weui_btn weui_btn_disabled weui_btn_default">按钮</a>
<div class="button_sp_area">
<a href="javascript:;" class="weui_btn weui_btn_plain_default">按钮</a>
<a href="javascript:;" class="weui_btn weui_btn_plain_primary">按钮</a>
<a href="javascript:;" class="weui_btn weui_btn_mini weui_btn_primary">按钮</a>
<a href="javascript:;" class="weui_btn weui_btn_mini weui_btn_default">按钮</a>
</div>