<view class="tel__wrap">
<button class="button10" bindtap="calling"><image class="tel_image" src="https://www.zcabc.com/d/file/p/84d4231c9eba7c5975231200605586c1.png"></image></button>
</view>
css部分(只需放在index.css最后的空白位置即可):
.tel__wrap {
position:fixed;right:26rpx;bottom:30rpx;z-index:3;
}
.tel__wrap .tel_image {
width:80rpx;height:80rpx;visibility:visible;opacity:0.6;
}
.tel__wrap .button10 {
visibility:hidden;margin:0;
}
js部分(放在每个js页面):
,calling: function (e) {
swan.makePhoneCall({
phoneNumber: ‘13032616880’,
success: function () {
console.log("拨打电话成功!")
},
fail: function () {
console.log("拨打电话失败!")
}
})
}