[小程序] 悬浮按钮

悬浮按钮

wxml代码

1
2
3
4
<image
bindtap='floatBtnTap'
style='position:fixed;width:80rpx;height:80rpx;position:fixed;bottom:60rpx;right:40rpx;'
src="../../path/to.png"/>

JS代码

1
2
3
4
5
6
7
8
9
//悬浮按钮点击事件
floatBtnTap: function(e) {
wx.navigateTo({
url: '/path/to',
success: function(res) {},
fail: function(res) {},
complete: function(res) {},
});
},