当前位置:网站首页>Uniapp dynamic sliding navigation effect demo (finishing)
Uniapp dynamic sliding navigation effect demo (finishing)
2022-08-04 23:19:00 【I am happy】
效果图:
<template>
<view class="content">
<!-- 导航区域 -->
<scroll-view class="scroll-view_H" scroll-x="true" scroll-left="0" enable-flex="true">
<view :class="['scroll-view-item_H',currentTab==index?'active':'']" v-for="(item,index) in navbar"
:key='index' @click="tabClick(index)">{
{
item}}</view>
</scroll-view>
<!-- 内容区域 -->
<swiper class="swiper" :current="currentTab" @change="swiperTab" :style="{height:swiperHeight+'px'}">
<swiper-item>
<view class="swiper-item">
A content navigation, content navigation navigation navigation a content
</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">
Navigation two navigation two content navigation two content navigation two content
</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">
Navigation three content navigation navigation three content navigation content
</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">
Navigation four content navigation navigation four content navigation four content
</view>
</swiper-item>
</swiper>
</view>
</template>
<script>
export default {
data() {
return {
navbar: ['导航一', '导航二', '导航三', '导航四'], //Navigation category
currentTab: 0, //The currently selected navigation category
swiperHeight: 0 //Dynamic givenswiper的高度
}
},
onLoad(option) {
this.swiperHeight = uni.getSystemInfoSync().windowHeight - 25;
console.log(this.swiperHeight);
},
methods: {
tabClick(index) {
this.currentTab = index
},
swiperTab(e) {
this.currentTab = e.detail.current; //获取索引
console.log("this.currentTab", this.currentTab)
}
}
}
</script>
<style lang="less" scoped>
.content {
width: 100%;
.scroll-view_H {
width: 100%;
height: 60rpx;
text-align: center;
line-height: 60rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
overflow: hidden;
.scroll-view-item_H {
flex-shrink: 0;
width: 300rpx;
color: #000000;
font-size: 30rpx;
font-size: bold;
background-color: #EA5149;
letter-spacing: .1em;
text-shadow: 0px 1px 2px #A42B14;
}
.active {
font-size: 40rpx;
color: #55aaff;
}
}
.swiper-item {
height: 100%;
}
}
</style>
边栏推荐
- 365天深度学习训练营-学习线路
- Will we still need browsers in the future?(feat. Maple words Maple language)
- I was rejected by the leader for a salary increase, and my anger rose by 9.5K after switching jobs. This is my mental journey
- CS8416国产替代DP8416 数字音频接收器
- 【游戏建模模型制作全流程】使用ZBrush制作骷髅王
- 【字符串函数内功修炼】strcpy + strcat + strcmp(一)
- [QNX Hypervisor 2.2用户手册]10.5 vdev ioapic
- 基于Appian低代码平台开发一个SpaceX网站
- C5750X7R2E105K230KA(电容器)MSP430F5249IRGCR微控制器资料
- 中国的顶级黑客在国际上是一个什么样的水平?
猜你喜欢

web3.js

【3D建模制作技巧分享】ZBrush模型如何添加不同材质

基于内容的图像检索系统设计与实现--颜色信息--纹理信息--形状信息--PHASH--SHFT特征点的综合检测项目,包含简易版与完整版的源码及数据!

【无标题】

Go 语言快速入门指南:什么是 TSL 安全传输层

一点点读懂Thremal(二)

MySQL的安装与卸载
![[Cultivation of internal skills of string functions] strlen + strstr + strtok + strerror (3)](/img/96/946bbef52bd017ac6142c6b7485a86.png)
[Cultivation of internal skills of string functions] strlen + strstr + strtok + strerror (3)

If you can't get your heart, use "distributed lock" to lock your people

go语言的日志实现(打印日志、日志写入文件、日志切割)
随机推荐
质量管理大师爱德华·戴明博士经典的质量管理14条原则
Vscode连接远程服务器(一套配置成功)
2022/8/3
VC bmp文件总结
Shell编程之循环语句与函数的使用
Kernel函数解析之kernel_restart
【游戏建模模型制作全流程】在ZBrush中雕刻恶魔城男性角色模型
xss总结
文献阅读十——Detect Rumors on Twitter by Promoting Information Campaigns with Generative Adversarial Learn
Laravel 实现redis分布式锁
生产者消费者问题
容联云发送短信验证码
【字符串函数内功修炼】strlen + strstr + strtok + strerror(三)
MySQL的JSON 数据类型1
4-《PyTorch深度学习实践》-反向传播
NebulaGraph v3.2.0 Release Note,对查询最短路径的性能等多处优化
Jbpm3.2 开发HelloWorld (简单请假流程)客户端
MySQL的JSON 数据类型2
MySQL的安装与卸载
被领导拒绝涨薪申请,跳槽后怒涨9.5K,这是我的心路历程