当前位置:网站首页>Applet sliding, clicking and switching simple UI
Applet sliding, clicking and switching simple UI
2022-07-07 09:48:00 【Dehong demon king】
List of articles
【 Zero foundation wechat applet introduction development 】 Small program introduction and environment construction
【 Zero foundation wechat applet introduction development 】 Configure applets
【 Zero foundation wechat applet introduction development 】 Applet framework 1
【 Zero foundation wechat applet introduction development 】 Applet framework 2
【 Zero foundation wechat applet introduction development 】 Basic ability ( One )
【 Zero foundation wechat applet introduction development 】 Basic ability ( Two )
Applet slide 、 Click to switch succinctly UI
Development encountered , Simply record , Slide the applet or click to switch styles
There's no demonstration here , Go straight to the code
wxml
<view>
<!-- Tab Layout -->
<view class='navBox'>
<view class='titleBox' bindtap='titleClick' data-idx='0'>
<text class="{
{0 == currentIndex ? 'fontColorBox' : ''}}"> Android </text>
<hr class="{
{0 == currentIndex ? 'lineBox' : 'notLineBox'}}" />
</view>
<view class='titleBox' bindtap='titleClick' data-idx='1'>
<text class="{
{1 == currentIndex ? 'fontColorBox1' : ''}}"> Apple </text>
<hr class="{
{1 == currentIndex ? 'lineBox' : 'notLineBox'}} " />
</view>
</view>
<!-- Content layout -->
<swiper class='swiperTtemBox' bindchange='pagechange' current='{
{currentIndex}}'>
<swiper-item class='swiperTtemBox'>
<view> Content 1</view>
</swiper-item>
<swiper-item class='swiperTtemBox'>
<view> Content 2</view>
</swiper-item>
</swiper>
</view>
js
const app = getApp()
Page({
data: {
currentIndex: 0, // Default first
},
pagechange: function (ee) {
if ("touch" === ee.detail.source) {
let currentPageIndex = this.data.currentIndex;
currentPageIndex = (currentPageIndex + 1) % 2;
this.setData({
currentIndex: currentPageIndex,
})
}
},
// Click on tab Trigger when
titleClick: function (e) {
this.setData({
// Get the current index and change it dynamically
currentIndex: e.currentTarget.dataset.idx
})
},
})
Put the code you need to write in the content 1 Replace it , You can easily click or slide the switch window ,js Data interaction can be handled uniformly , The same load is just the layout of the display , Others are the same
️️️️️️ 🥳🥳🥳 Thousands of people , Thank you for reading my article at this moment , Thanks for watching , Hello, everyone , Welcome to the artificial intelligence exchange group ( Watch my news ), More peripheral benefits are waiting for you 🥳🥳🥳
Welcome to subscribe to this column or follow me , Let's work together to solve an algorithm problem every day
️️️ Last , I hope my article can be helpful to your !
I wish myself and you in the future , Keep learning , Keep improving , Keep loving , Go to the mountains and seas ! ️️️
边栏推荐
- Check the example of where the initialization is when C initializes the program
- VSCode+mingw64+cmake
- 如何成为一名高级数字 IC 设计工程师(5-2)理论篇:ULP 低功耗设计技术精讲(上)
- MySQL can connect locally through localhost or 127, but cannot connect through intranet IP (for example, Navicat connection reports an error of 1045 access denied for use...)
- JS judge whether checkbox is selected in the project
- H5网页播放器EasyPlayer.js如何实现直播视频实时录像?
- IIS faked death this morning, various troubleshooting, has been solved
- IIS redirection redirection appears eurl axd
- Scratch crawler mysql, Django, etc
- Write VBA in Excel, connect to Oracle and query the contents in the database
猜你喜欢
【frida实战】“一行”代码教你获取WeGame平台中所有的lua脚本
战略合作|SubQuery 成为章鱼网络浏览器的秘密武器
第一讲:寻找矩阵的极小值
Unity uses mesh to realize real-time point cloud (I)
Impression notes finally support the default markdown preview mode
JS逆向教程第一发
如何使用clipboard.js库实现复制剪切功能
[Frida practice] "one line" code teaches you to obtain all Lua scripts in wegame platform
沙龙预告|GameFi 领域的瓶颈和解决方案
Oracle installation enhancements error
随机推荐
Lesson 1: finding the minimum of a matrix
第一讲:鸡蛋的硬度
csdn涨薪技术-浅学Jmeter的几个常用的逻辑控制器使用
Diffusion模型详解
thinkphp3.2信息泄露
How to solve the problem of golang select mechanism and timeout
Information Security Experiment 4: implementation of IP packet monitoring program
thinkphp数据库的增删改查
Information Security Experiment 3: the use of PGP email encryption software
Vs2013 generate solutions super slow solutions
How does mongodb realize the creation and deletion of databases, the creation of deletion tables, and the addition, deletion, modification and query of data
Check the example of where the initialization is when C initializes the program
Nested (multi-level) childrn routes, query parameters, named routes, replace attribute, props configuration of routes, params parameters of routes
Can't connect to MySQL server on '(10060) solution summary
js逆向教程第二发-猿人学第一题
有没有大佬帮忙看看这个报错,有啥排查思路,oracle cdc 2.2.1 flink 1.14.4
14th test
基础篇:带你从头到尾玩转注解
How to become a senior digital IC Design Engineer (1-6) Verilog coding Grammar: Classic Digital IC Design
Flex flexible layout