惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
N
Netflix TechBlog - Medium
腾讯CDC
C
Check Point Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
S
SegmentFault 最新的问题
F
Fortinet All Blogs
美团技术团队
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
F
Full Disclosure
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
J
Java Code Geeks
I
InfoQ
Y
Y Combinator Blog
A
About on SuperTechFans
AI
AI
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Forbes - Security
Forbes - Security
W
WeLiveSecurity
M
MIT News - Artificial intelligence
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
V2EX - 技术
V2EX - 技术
Project Zero
Project Zero

博客园 - KidYang

微信、支付宝个人收款码不能用于经营收款 - z 微信平台开发 微信小程序图表控件 微信小程序网络排查指引 小程序字体转换 - 转 小程序播放语音之wx.createInnerAudioContext() - 转 小程序隐藏scroll-view滚动条的实现 - 转 用vscode开发微信小程序,建议安装的插件 微信小程序wxs格式化日期 在 ios 端显示NaN问题及日期格式化工具 小程序涉及npm、vue的一些基础资料 visual studio 关于 Updates were rejected because the remote contains work that you do 小程序使用字体相关 大量Timer_MinBytesPerSecond,Timer_ConnectionIdle错误 - 转 微信小程序隐藏时动画效果 - 转载 System.Security.Cryptography.RSA.FromXmlString 系统找不到指定的文件和X509读取证书文件系统找不到指定的文件异常 - 转载 sqlserver 发送http请求 chrome浏览器直接打印 - z 解决webapi首次启动速度慢的问题 - z 使用第三方库(Senparc)完成小程序支付 - z
微信小程序scroll-view左右横向滑动
KidYang · 2020-05-12 · via 博客园 - KidYang

小程序组件 scroll-view 中分别有上下竖向滑动和左右横向滑动之分,在这次项目中刚好需要用到横向滑动,但在测试过程中发现横向滑动没有了效果(静止在那里没移动过),经调试发现:

1.scroll-view 中的需要滑动的元素不可以用 float 浮动;

2.scroll-view 中的包裹需要滑动的元素的大盒子用 display:flex; 是没有作用的;

3.scroll-view 中的需要滑动的元素要用 dislay:inline-block; 进行元素的横向编排;

4.包裹 scroll-view 的大盒子有明确的宽和加上样式-->  overflow:hidden;white-space:nowrap;

具体的测试代码如下:

.wxml

<view class="scroll_box"> 
    <scroll-view scroll-x>
 
      <view class="item_list" >
        1
      </view>
      <view class="item_list" >
        2
      </view>
      <view class="item_list" >
        3
      </view>
      <view class="item_list" >
        4
      </view>
      <view class="item_list" >
        5
      </view>
      <view class="item_list" >
        6
      </view>
     
    </scroll-view>
  </view>

.wxss

.scroll_box{
width: 100%;
height: 307rpx;
overflow: hidden;
padding: 20rpx;
background: #fff;
white-space: nowrap;
border: 1px solid red;
}
.scroll_box scroll-view{
  height: 100%;
  width: auto;
  overflow:hidden;
}
.item_list{
width: 160rpx;
height: 100%;
margin-right: 23rpx;
display: inline-block;
margin-left: 10px;
background-color: blue;
 
}