当前位置:网站首页>[wechat applet] basic horizontal and vertical scroll view (95/100)
[wechat applet] basic horizontal and vertical scroll view (95/100)
2022-07-18 12:21:00 【lichong951】

Layout :
<!--pages/scrollView/scrollView.wxml-->
<text>Vertical Scroll\n Roll vertically </text>
<scroll-view scroll-y="true" style="height: 500rpx;" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-into-view="{
{toView}}" scroll-top="{
{scrollTop}}">
<view id="demo1" class="scroll-view-item demo-text-1"></view>
<view id="demo2" class="scroll-view-item demo-text-2"></view>
<view id="demo3" class="scroll-view-item demo-text-3"></view>
</scroll-view>
<view class="page-section-title">
<text>Horizontal Scroll\n Roll horizontally </text>
</view>
<view class="page-section-spacing">
<scroll-view class="scroll-view_H" scroll-x="true" bindscroll="scroll" style="width: 100%">
<view id="demo1" class="scroll-view-item_H demo-text-1"></view>
<view id="demo2" class="scroll-view-item_H demo-text-2"></view>
<view id="demo3" class="scroll-view-item_H demo-text-3"></view>
</scroll-view>
</view>
style :
/* pages/scrollView/scrollView.wxss */
.page-section-spacing{
margin-top: 60rpx;
}
.scroll-view_H{
white-space: nowrap;
}
.scroll-view-item{
height: 300rpx;
}
.scroll-view-item_H{
display: inline-block;
width: 100%;
height: 300rpx;
}
The model and control are as follows :
// pages/scrollView/scrollView.js
Page({
/** * Initial data of the page */
data: {
toView: 'green'
},
tap() {
for (let i = 0; i < order.length; ++i) {
if (order[i] === this.data.toView) {
this.setData({
toView: order[i + 1],
scrollTop: (i + 1) * 200
})
break
}
}
},
tapMove() {
this.setData({
scrollTop: this.data.scrollTop + 10
})
},
upper(e) {
console.log(e)
},
lower(e) {
console.log(e)
},
scroll(e) {
console.log(e)
},
scrollToTop() {
this.setAction({
scrollTop: 0
})
},
/** * Life cycle function -- Monitor page loading */
onLoad(options) {
},
Different from the official website , However, I still try to simplify . Simple points are better than complex wisdom
边栏推荐
- Terraform命令行工具介紹、安裝、使用
- What is the function of GIS service platform for pipe network management?
- Web 编程面试题(2022)
- 长安链介绍-02
- Simulation of common functions in C language
- 2022年7月16日CDGA/CDGP数据治理认证考试成绩出来啦!
- Kettle [practice 02] TXT type files are classified and imported, execute SQL to convert data types and put them into storage (complete process instance cloud resource sharing: including sql+kjb+ktr+ t
- C # résoudre les json imbriqués en utilisant jobject
- JVM tuning practice (detailed version)
- Does Google | map neural network pre training help molecular characterization
猜你喜欢

JVM调优实战(详细版)

Xunwei Godson development board domestic dual core 64 bit loognix system dual Gigabit Ethernet more interfaces

Simulation of common functions in C language

Redis数据结构实战演练,看看微博、微信、购物车、抽奖小程序是如何使用的?

Database system probability -- relational database

谷歌 | 图神经网络预训练帮助了分子表征吗

汉字风格迁移篇--基于生成对抗网络的无监督字体风格转换模型

【微信小程序】简洁好用的icon(94/100)

ThreadLocal killed 11 people. I can't bear it

Flink basic record supplement
随机推荐
【MOCO基础】Attention, learn to solve routing problems(Wouter Kool, 2018)
ThreadLocal killed 11 people. I can't bear it
今晚8点! LightDB PG分布式数据库技术创新与实践”
GDB or delve debug Go program, check variable display < optimized out > solution
C # résoudre les json imbriqués en utilisant jobject
Openeuler knowledge: common website
Openeuler knowledge: log search skills
Kettle [practice 02] TXT type files are classified and imported, execute SQL to convert data types and put them into storage (complete process instance cloud resource sharing: including sql+kjb+ktr+ t
Image denoising using nlmeas
Why is it said that big companies are not paradise? What pits are there?
Reverse learning notes (I)
圖片格式解析
自动推理的逻辑01
Openeuler knowledge: management strategy
The official website of the Chinese version of "selected examples of open agile architecture case study" was officially launched, and a wonderful preview!
2022年7月16日CDGA/CDGP数据治理认证考试成绩出来啦!
Four reasons for programmers' headaches | daily anecdotes
2022年成都/杭州/厦门/武汉产品经理认证招生简章(NPDP)
[chicken soup] things are difficult and easy in the world
Overview of database system -- overview of data model