微信小程序给button加链接
微信小程序button里面无法添加onclick事件,需要在js里面写。
WXML代码:<button type="idcard" value="{{order_amount}}" class="carBtn" data-refund_id="{{refund_id}}" id="{{refund_id}}" bindtap="goTodocommunicate_history"> ></button>
JS代码:
goTodocommunicate_history :function(e){
var refund_id = e.currentTarget.dataset.refund_id
console.log(refund_id)
wx.navigateTo({
url: '../refund/communicate_history?refund_id='+ refund_id,
});
},
按钮变透明的css样式
.carBtn{
background-color:transparent;
}
效果图片: