当前位置:网站首页>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 ! ️️️
边栏推荐
- 第一讲:寻找矩阵的极小值
- Gym - 102219j kitchen plates (violent or topological sequence)
- [4g/5g/6g topic foundation -147]: Interpretation of the white paper on 6G's overall vision and potential key technologies -2-6g's macro driving force for development
- Netease cloud wechat applet
- C# 初始化程序时查看初始化到哪里了示例
- 洛谷P2482 [SDOI2010]猪国杀
- Database multi table Association query problem
- 2020浙江省赛
- Communication mode between processes
- AI从感知走向智能认知
猜你喜欢
随机推荐
JS reverse tutorial second issue - Ape anthropology first question
农牧业未来发展蓝图--垂直农业+人造肉
Luogu p2482 [sdoi2010] zhuguosha
VSCode+mingw64+cmake
小程序滑动、点击切换简洁UI
How to use clipboard JS library implements copy and cut function
thinkphp数据库的增删改查
CMD startup software passes in parameters with spaces
Lecture 1: stack containing min function
liunx命令
Can't connect to MySQL server on '(10060) solution summary
Liunx command
Gym - 102219J Kitchen Plates(暴力或拓扑序列)
Unity shader (basic concept)
第一讲:鸡蛋的硬度
Addition, deletion, modification and query of ThinkPHP database
How to speed up video playback in browser
消费互联网的产业链其实是很短的,它仅仅承接平台上下游的对接和撮合的角色
12、 Sort
小程序实现页面多级来回切换支持滑动和点击操作