最近项目用到了weui 可以自定义tab切换,指定第几个tab激活状态,很方便
<div class="weui-tab weui-bs-tab" id="tab">
<div class="weui-navbar">
<div class="weui-navbar__item">数字货币充值</div>
<div class="weui-navbar__item">法定货币充值</div>
</div>
<div class="weui-tab__panel">
<div class="weui-tab__content">
<div class="form-main">
<div class="form-group">
<div class="form-label">选择币种</div>
<div class="form-row form-coin-row">
<div class="flex_bd">
<input type="text" class="weui-input" id="coinVal" placeholder="" readonly="readonly" value="USDT">
</div>
<div class="iconfont icon-down"></div>
</div>
</div>
<div class="form-group">
<div class="form-label">传输网络</div>
<ul class="web-tags clearfix">
<li class="active"><a href="recharge-pay.html">TRC20</a></li>
</ul>
</div>
<div class="form-group">
<div class="form-label">充值金额</div>
<div class="form-row">
<div class="flex_bd">
<input type="text" class="weui-input" placeholder="请输入">
</div>
</div>
</div>
<div class="form-tip">
注意:<br>
禁止向USDT[TRC20]地址充值除USDT[TRC20]之外的资产,任何非USDT[TRC20]资产充入USDT[TRC20]地址将不可到账并不可找回。<br>
充值时间为10-30分钟到账
</div>
<div class="form-button">
<button class="weui-btn weui-btn_block weui-btn_primary" id="digitalRecharge" type="button">确认</button>
</div>
</div>
</div>
<div class="weui-tab__content">
<div class="form-main">
<div class="form-group">
<div class="form-label">折合法币</div>
<div class="form-row">
<div class="flex_bd">
<input type="number" id="inrPrice" class="weui-input" placeholder="请输入" >
</div>
<div class="mark-span legal-cion"><span class="mark-v legal-v">INR</span> <span class="iconfont icon-down"></span></div>
</div>
</div>
<div class="form-group">
<div class="form-label">充值数量</div>
<div class="form-row">
<div class="flex_bd">
<input type="text" class="weui-input" placeholder="请输入">
</div>
<div class="mark-span"><span class="mark-v">USDT</span></div>
</div>
</div>
<div class="form-tip text-green">
法币充值提示:<br>
充值金额3500INR(后台编辑)<br>
充值时间为10-30分钟到账(后台编辑)
</div>
<div class="form-button">
<button class="weui-btn weui-btn_block weui-btn_primary" id="legalRecharge" type="button">确认</button>
</div>
</div>
</div>
</div>
</div>
weui.tab('#tab',{
defaultIndex: 0,
onChange: function(index){
console.log(index);
if (index == 0) {
$('.icon-jilu-a').show()
$('.icon-jilu-b').hide()
} else{
$('.icon-jilu-a').hide()
$('.icon-jilu-b').show()
}
}
});