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

时间:2019-11-07 19:08:28   收藏:0   阅读:285

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

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: ‘已复制到剪切板‘,
});
}
})
},

 

评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!