当前位置:首页 > 微信 > 正文

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

11-25 微信

标签:剪切板   全屏   com   set   nbsp   tps   lan   ini   style   

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

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

 

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

标签:剪切板   全屏   com   set   nbsp   tps   lan   ini   style   

温馨提示: 本文由杰米博客推荐,转载请保留链接: https://www.jmwww.net/weixin/15608.html

博客主人杰米WWW
杰米博客,为大家提供seo以及it方面技巧喜欢的朋友收藏哦!
  • 11365文章总数
  • 2266821访问次数
  • 建站天数
  • 头条文章

    图文推荐

    站长推荐

    友情链接