网页开发的时候往往会为了页面的美观,而选择去掉滚动区域默认的滚动条。微信小程序实现scroll-view隐藏滚动条的方法之一:
首先我们来看一下,scroll-view的一些属性组件

使用竖向滚动时,需要给
再来看一些简单的代码示例:
<view> <view>vertical scroll</view> <scroll-view> <view></view> <view></view> <view></view> <view></view> </scroll-view> <view> <button>click me to scroll into view </button> <button>click me to scroll</button> </view></view><view> <view>horizontal scroll</view> <scroll-view> <view></view> <view></view> <view></view> <view></view> </scroll-view></view>
var order = ['red', 'yellow', 'blue', 'green', 'red']
Page({
data: {
toView: 'red',
scrollTop: 100
},
upper: function(e) {
console.log(e)
},
lower: function(e) {
console.log(e)
},
scroll: function(e) {
console.log(e)
},
tap: function(e) {
for (var i = 0; i <p><img src="https://img.php.cn//upload/image/503/661/452/1489642942174580.png?x-oss-process=image/resize,p_40" title="微信小程序开发实现scroll-view隐藏滚动条方法介绍" alt="微信小程序开发实现scroll-view隐藏滚动条方法介绍" style="max-width:90%" style="max-width:90%"></p><p><img src="https://img.php.cn//upload/image/885/649/303/1489642971911534.png?x-oss-process=image/resize,p_40" title="微信小程序开发实现scroll-view隐藏滚动条方法介绍" alt="微信小程序开发实现scroll-view隐藏滚动条方法介绍" style="max-width:90%" style="max-width:90%"></p><div class="aritcle_card flexRow artxards">
<div class="artcardd flexRow">
<a class="aritcle_card_img" rel="nofollow" href="/xiazai/skill11997" title="微信小程序隐私权限调试"><img
src="https://img.php.cn/upload/skill/001/246/273/6adaf20dbae7c507.jpg" alt="微信小程序隐私权限调试" onerror="this.onerror='';this.src='/static/lhimages/moren/morentu.png'" ></a>
<div class="aritcle_card_info flexColumn">
<a rel="nofollow" href="/xiazai/skill11997" title="微信小程序隐私权限调试" class="overflowclass">微信小程序隐私权限调试</a>
<p class="overflowclass">一站式排查小程序隐私授权报错(errno 104 / buttonId is wrong 等)+ 标准修改模式。适用:隐私协议配置、隐私弹窗不弹、授权报错、隐私接口调用失败。已抽离具体项目,适用于任何微信小程序。</p>
</div>
<a rel="nofollow" href="/xiazai/skill11997" title="微信小程序隐私权限调试" class="aritcle_card_btn flexRow flexcenter"><b></b><span>下载</span>
</a>
</div>
</div><p>效果图如下:</p><p><img src="https://img.php.cn//upload/image/854/287/334/1489643137709656.png?x-oss-process=image/resize,p_40" title="微信小程序开发实现scroll-view隐藏滚动条方法介绍" alt="微信小程序开发实现scroll-view隐藏滚动条方法介绍" style="max-width:90%" style="max-width:90%"></p><p>注意:<br>(1)不能在scroll-view中使用textarea,mao,<a href="http://www.php.cn/code/7892.html" target="_blank">canvas</a>,video组件<br>(2)scroll-init-view的<a href="http://www.php.cn/code/6066.html" target="_blank">优先级</a>高于scroll-top<br>(3)onPullDownRefresh<a href="http://www.php.cn/js/js-jspopular-guide-event.html" target="_blank">事件</a>,无法在scroll-view中触发<br>(4)若想使用下拉刷新,一定要使用页面的滚动,而不是scroll-view,这样也能通过点击顶部<a href="http://www.php.cn/code/8243.html" target="_blank">状态</a>栏回到页面顶部</p><p><br></p>










