uniapp實現(xiàn)可以左右滑動導航欄
更新時間:2020年10月21日 11:09:34 作者:Mr.冬冬
這篇文章主要為大家詳細介紹了uniapp 實現(xiàn)可以左右滑動導航欄,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實例為大家分享了uniapp實現(xiàn)左右滑動導航欄的具體代碼,供大家參考,具體內(nèi)容如下
<template>
<view>
<home-view></home-view>
<view class="content-box" :id="isScale?'content-box-too':''">
<view class="nav-head-box top-nav-fixed">
<image @click="isScale=!isScale" class="icon-style" src="/static/iconImg/list.png" mode=""></image>
<view style="height: 100%;" class="ft-color-white ft-36 flex-1 flex-wrap align-items-center justify-content-center">
PIQSCORE
</view>
<text style="margin-right: 16upx;" class="iconfont icon-UI_icon_shebeisheshi ft-44 ft-color-red"></text>
<text style="right: 30upx;bottom: 14upx;" class="iconfont icon-UI_icon_shebeisheshi ft-color-red ft-32 position-absolute"></text>
</view>
<view class="m-top-128 top-nav width-100 pd-f-r-36 ft-color-white flex-nowrap space-between position-relative">
<view v-for="(item,index) in 4" :key="index" @click="currentIndex=index" class="top-nav-item">
ALL
</view>
<view :style="'left:'+(currentIndex*164+36)+'upx'" class="position-absolute top-nav-child"></view>
</view>
<swiper style="height: 1122upx;" :current="currentIndex" @change="swiperTab">
<swiper-item v-for="(item,index) in list" :key="index">
<view class="width-100 height-100" style="background: #CCCCCC;">
{{index}}
</view>
</swiper-item>
</swiper>
</view>
</view>
</template>
<script>
export default{
data(){
return{
isScale:false,
currentIndex:0,
list:["ALL","ALL","ALL","ALL"]
}
},
methods:{
swiperTab(e) {
this.currentIndex = e.detail.current //獲取索引
},
}
}
</script>
<style>
.top-nav{
height: 84upx;
background: #008800;
}
.top-nav-item{
width: 168upx;
line-height: 82upx;
text-align: center;
}
.top-nav-child{
left: 0;
bottom: 0;
width: 164upx;
background: #32B53F;
height: 6upx;
transition: all 0.5s;
}
</style>

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
用js實現(xiàn)before和after偽類的樣式修改的示例代碼
本篇文章主要介紹了用js實現(xiàn)before和after偽類的樣式修改的示例代碼,具有一定的參考價值,有興趣的可以了解一下2017-09-09
對 lightbox JS 圖片控件進行了一下改造, 使其他支持復雜的圖片說明
如果要為圖片添加詳細的圖片說明,并為圖片的說明設置一些格式,如字體的大小、顏色等,那么使用 title 這個屬性來設置這些說明信息是沒辦法實現(xiàn)的。2010-03-03
javascript操作向表格中動態(tài)加載數(shù)據(jù)
這篇文章主要為大家詳細介紹了javascript操作向表格中動態(tài)加載數(shù)據(jù),文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2020-08-08
Javascript 網(wǎng)頁黑白效果實現(xiàn)代碼(兼容IE/FF等)
今天在網(wǎng)上看到有人推薦的一個不錯的方法,試了一下,效果還是可以的,可以自定義讓網(wǎng)頁的某一部分變成灰度顏色(黑白)。2010-04-04

