微信小程序?qū)崿F(xiàn)側(cè)邊導(dǎo)航欄
本文實(shí)例為大家分享了微信小程序?qū)崿F(xiàn)側(cè)邊導(dǎo)航欄的具體代碼,供大家參考,具體內(nèi)容如下
效果圖

wxml
<view class='productNav'>
? <!-- 左側(cè) -->
? <view class='left'>
? ? <view class="{{active==0?'selected':'normal'}}" id="0" bindtap='switchNav'>為您推薦</view>
? ? <view class="{{active==1?'selected':'normal'}}" id="1" bindtap='switchNav'>電腦</view>
? ? <view class="{{active==2?'selected':'normal'}}" id="2" bindtap='switchNav'>手機(jī)</view>
? </view>
? <!-- 右側(cè) -->
? <view class='right'>
? ? <view class='type'>
? ? ? <!-- current:當(dāng)前所在滑塊的 index -->
? ? ? <!-- vertical:滑動(dòng)方向是否為縱向 -->
? ? ? <swiper current='{{currentTab}}' vertical='{{true}}'>
? ? ? ? <!-- catchtouchmove 阻止彈窗后滾動(dòng)穿透 -->
? ? ? ? <swiper-item id="0" catchtouchmove="false">
? ? ? ? ? 為您推薦
? ? ? ? </swiper-item>
? ? ? ? <swiper-item id="1" catchtouchmove="false">
? ? ? ? ? 手機(jī)
? ? ? ? </swiper-item>
? ? ? ? <swiper-item id="2" catchtouchmove="false">
? ? ? ? ? 電腦
? ? ? ? </swiper-item>
? ? ? </swiper>?
? ? </view>
? </view>
</view>js
Page({
? data: {
? ? active:0,
? ? currentTab:0
? },
? switchNav: function (e) {
? ? var page = this;
? ? var id = e.target.id;
? ? if (this.data.currentTab == id) {
? ? ? return false;
? ? } else {
? ? ? page.setData({
? ? ? ? currentTab: id
? ? ? });
? ? }
? ? page.setData({
? ? ? active: id
? ? });
? }
?})wxss
.productNav{
? display: flex;
? flex-direction: row;
? font-family: "Microsoft YaHei"
}
.left{
? width: 25%;
? font-size: 30rpx;
? background-color: #f4f4f4;
}
.left view{
? text-align: center;
? height: 90rpx;
? line-height: 90rpx;
}
.selected{
? background-color: #fff;
? border-left: 2px solid #E54847;
? font-weight: bold;
? color: #E54847;
}
.normal{
? background-color: #f4f4f4;
? border-bottom: 1px solid #f2f2f2;
}
.right{
? width:75%;
? margin: 0;
}
swiper{
? height: 500px;
}以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- 微信小程序自定義頂部導(dǎo)航欄并適配不同機(jī)型實(shí)例詳解
- 微信小程序動(dòng)態(tài)設(shè)置導(dǎo)航欄標(biāo)題的實(shí)現(xiàn)步驟
- 小程序自定義tabbar導(dǎo)航欄及動(dòng)態(tài)控制tabbar功能實(shí)現(xiàn)方法(uniapp)
- 微信小程序使用uni-app實(shí)現(xiàn)首頁(yè)搜索框?qū)Ш綑诠δ茉斀?/a>
- uniapp小程序配置tabbar底部導(dǎo)航欄實(shí)戰(zhàn)指南
- 微信小程序自定義漸變的tabbar導(dǎo)航欄功能
- uniapp開(kāi)發(fā)微信小程序自定義頂部導(dǎo)航欄功能實(shí)例
- uniapp微信小程序自定義導(dǎo)航欄的全過(guò)程
- 微信小程序?qū)崿F(xiàn)自定義導(dǎo)航欄
- 微信小程序自定義導(dǎo)航欄功能的實(shí)現(xiàn)
相關(guān)文章
JavaScript位置參數(shù)實(shí)現(xiàn)原理及過(guò)程解析
這篇文章主要介紹了JavaScript位置參數(shù)實(shí)現(xiàn)原理及過(guò)程解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-09-09
靜態(tài)頁(yè)面也可以實(shí)現(xiàn)預(yù)覽 列表不同的顯示方式
靜態(tài)頁(yè)面也可以實(shí)現(xiàn)預(yù)覽 列表不同的顯示方式...2006-10-10
javascript判斷兩個(gè)IP地址是否在同一個(gè)網(wǎng)段的實(shí)現(xiàn)思路
要判斷兩個(gè)IP地址是否在同一個(gè)網(wǎng)段,將它們的IP地址分別與子網(wǎng)掩碼做與運(yùn)算,得到的結(jié)果為網(wǎng)絡(luò)號(hào),具體實(shí)現(xiàn)如下,需要的朋友可以參考下2013-12-12
JS獲得多個(gè)同name 的input輸入框的值的實(shí)現(xiàn)方法
這篇文章主要介紹了基于JS代碼實(shí)現(xiàn)input密碼輸入框輸入密碼變黑點(diǎn)密文以及JS獲得多個(gè)同name 的input輸入框的值的實(shí)現(xiàn)方法,代碼簡(jiǎn)單易懂,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下2017-01-01
JavaScript中關(guān)于iframe滾動(dòng)條的去除和保留
在開(kāi)發(fā)中經(jīng)常遇到去掉全部的滾動(dòng)條,去掉右邊的滾動(dòng)條且保留底下的滾動(dòng)條,去掉底下的滾動(dòng)條且保留右邊的滾動(dòng)條,大家基于js是怎么實(shí)現(xiàn)的呢?下面小編通過(guò)本文給大家詳細(xì)介紹下,對(duì)js iframe滾動(dòng)條相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)吧2016-11-11

