当前位置:网站首页>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 ! ️️️
边栏推荐
- 基于智慧城市与储住分离数字家居模式垃圾处理方法
- 根据热门面试题分析Android事件分发机制(一)
- 20排位赛3
- Information Security Experiment 2: using x-scanner scanning tool
- asp. How to call vb DLL function in net project
- CDZSC_2022寒假个人训练赛21级(2)
- How will fashion brands enter the meta universe?
- NETCORE 3.1 solves cross domain problems
- Use 3 in data modeling σ Eliminate outliers for data cleaning
- 【BW16 应用篇】安信可BW16模组/开发板AT指令实现MQTT通讯
猜你喜欢
Elaborate on MySQL mvcc multi version control
How to speed up video playback in browser
How will fashion brands enter the meta universe?
H5网页播放器EasyPlayer.js如何实现直播视频实时录像?
js逆向教程第二发-猿人学第一题
Vs2013 generate solutions super slow solutions
20排位赛3
Octopus future star won a reward of 250000 US dollars | Octopus accelerator 2022 summer entrepreneurship camp came to a successful conclusion
细说Mysql MVCC多版本控制
JS逆向教程第一发
随机推荐
CentOS installs JDK1.8 and mysql5 and 8 (the same command 58 in the second installation mode is common, opening access rights and changing passwords)
使用BigDecimal的坑
Dynamics 365online applicationuser creation method change
Lesson 1: hardness of eggs
小程序弹出半角遮罩层
Thinkphp3.2 information disclosure
H5网页播放器EasyPlayer.js如何实现直播视频实时录像?
HCIP 第一天 笔记整理
sql 里面使用中文字符判断有问题,哪位遇到过?比如value&lt;&gt;`无`
Sqlplus garbled code problem, find the solution
ViewPager2和VIewPager的区别以及ViewPager2实现轮播图
Write VBA in Excel, connect to Oracle and query the contents in the database
[bw16 application] Anxin can realize mqtt communication with bw16 module / development board at instruction
# Arthas 简单使用说明
CDZSC_2022寒假个人训练赛21级(2)
高斯消元
How to use Mongo shake to realize bidirectional synchronization of mongodb in shake database?
H5 web player easyplayer How does JS realize live video real-time recording?
Natapp intranet penetration
asp. How to call vb DLL function in net project