微信小程序实现(禁止页面滚动、长按复制)

微信小程序实现(禁止页面滚动、长按复制)

1. 禁止页面滚动
对于小程序某些一屏的页面,特别是全屏的swiper,并不希望页面在竖直方向上可以滚动。

实现方式:
在需要禁止滚动页面的json中加入:

"disableScroll": true
1

注意:只在页面配置中有效,无法再app.json中设置该项

参考:https://developers.weixin.qq.com/miniprogram/dev/framework/config.html#页面配置

2. 长按复制

<text class='copy_content' bindlongpress='onLongTap' >{{copyContent}}</text>

1
2
onLongTap: function(e) {
let that = this
wx.setClipboardData({
data: that.data.copyContent,
success: function (res) {
wx.showToast({
title: '已复制到剪切板',
});
}
})
},

猜你喜欢

转载自www.cnblogs.com/lanshu/p/11814023.html