最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

微信小程序?qū)崿F(xiàn)選項卡的簡單實例

 更新時間:2022年07月18日 15:48:17   作者:itfallrain  
這篇文章主要介紹了微信小程序?qū)崿F(xiàn)選項卡的簡單實例,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了微信小程序?qū)崿F(xiàn)選項卡的具體代碼,供大家參考,具體內(nèi)容如下

效果圖

實現(xiàn)的功能:點擊上面選項卡,下面商品內(nèi)容實現(xiàn)切換,滑動下面的商品頁面,上面的選項也隨頁面進行切換。

text.wxml:

<!-- 分類 -->
<view class='listMiddle swiper-tab'>
? <view class='middle {{currentTab==0? "action" : ""}}' data-current="0" bindtap="clickTab">
? ? 全部
? </view>
? <view class='middle {{currentTab==1? "action":""}}' data-current="1" bindtap="clickTab">
? ? 分類1
? </view>
? <view class='middle {{currentTab==2? "action":""}}' data-current="2" bindtap="clickTab">
? ? 分類2
? </view>
? <view class='middle {{currentTab==3? "action":""}}' data-current="3" bindtap="clickTab">
? ? 分類3
? </view>
</view>
<!-- 精選商品 -->
<swiper current="{{currentTab}}" duration="300" bindchange="swiperTab" >
//注意這里只是寫了循環(huán)出來一條數(shù)據(jù),要實現(xiàn)多條數(shù)據(jù),要學(xué)會用數(shù)據(jù)嵌套循環(huán)哦~~
? <swiper-item wx:for="{{jingxuan}}">
? ? <view class='loopmiddle'>
? ? ? <view class='lo-left'>
? ? ? ? <image src='{{item.hua}}'></image>
? ? ? </view>
? ? ? <view class='lo-middle'>
? ? ? ? <view>{{item.guo}}</view>
? ? ? ? <view>{{item.zhigong}}</view>
? ? ? ? <view class='loo-bottom'>
? ? ? ? ? <text>{{item.qi}}</text>
? ? ? ? ? <image src='{{item.huo}}'></image>
? ? ? ? ? <text>{{item.fen}}</text>
? ? ? ? </view>
? ? ? </view>
? ? ? <view class='lo-right'>
? ? ? ? <image src='{{item.xiaoche}}'></image>
? ? ? </view>
? ? </view>
? </swiper-item>
</swiper>

test.js

var app = getApp()
Page({

? /**
? ?* 頁面的初始數(shù)據(jù)
? ?*/
? data: {
? ? jingxuan: [{
? ? ? hua: "../../assets/hua.png", guo: "9.9元1斤驚爆價 - A級千禧圣女果", zhigong: "產(chǎn)地直供,一箱約8斤", qi: "¥71.90", huo: "../../assets/huomiao.png", fen: "已購999份", xiaoche: "../../assets/xiaoche.png", },
? ? ? {
? ? ? hua: "../../assets/hua.png", guo: "9.9元1斤驚爆價 - A級千禧圣女果", zhigong: "產(chǎn)地直供,一箱約8斤", qi: "¥72.90", huo: "../../assets/huomiao.png", fen: "已購999份", xiaoche: "../../assets/xiaoche.png", },
? ? ? {
? ? ? hua: "../../assets/hua.png", guo: "9.9元1斤驚爆價 - A級千禧圣女果", zhigong: "產(chǎn)地直供,一箱約8斤", qi: "¥73.90", huo: "../../assets/huomiao.png", fen: "已購999份", xiaoche: "../../assets/xiaoche.png", },
? ? ? {
? ? ? hua: "../../assets/hua.png", guo: "9.9元1斤驚爆價 - A級千禧圣女果", zhigong: "產(chǎn)地直供,一箱約8斤", qi: "¥74.90", huo: "../../assets/huomiao.png", fen: "已購999份", xiaoche: "../../assets/xiaoche.png", },
? ? ],
? ? currentTab: 0,
? },

? //滑動切換
? swiperTab: function (e) {
? ? var that = this;
? ? that.setData({
? ? ? currentTab: e.detail.current
? ? ??
? ? });
? ? console.log(e.detail.current)
? },
? //點擊切換
? clickTab: function (e) {

? ? var that = this;

? ? if (this.data.currentTab === e.target.dataset.current) {
? ? ? return false;
? ? } else {
? ? ? that.setData({
? ? ? ? currentTab: e.target.dataset.current
? ? ? })
? ? }
? } ,

text.wxss

/* 分類 */
.listMiddle{
? display: flex;
? font-size: 40rpx;
? border-bottom: 1px solid #ebebeb;
? height: 90rpx;
? line-height: 90rpx;
?
}
.middle{
? ?margin-left: 60rpx;?
? ?height: 90rpx;
? ?width: 120rpx;

}


.action{
? height: 90rpx;
? width: 120rpx;
? color: #3ad965;
? border-bottom:2px solid #3ad965;
}
/* 精選商品開始 */
.loopmiddle{
? ?width: 690rpx;
? margin: 5rpx auto 0;
? /* overflow: hidden; */
? display: flex;
? margin-bottom: 40rpx;
? border-bottom: 1rpx solid #eff0f4;
}

.lo-left{
? /* float: left; */
? height: 250rpx;
? width: 250rpx;
}
.lo-left image{
? height: 250rpx;
? width: 250rpx;
}
.lo-middle{
? margin-top:40rpx;
}
.lo-middle view:nth-child(1){
? font-size:25rpx;
? color:#676767;
? margin-left: 10rpx;

}
.lo-middle view:nth-child(2){
? font-size:20rpx;
? color:#adadad;
? margin-top:20rpx;
? margin-left: 10rpx;


}
.loo-bottom{
? margin-top: 40rpx;
}
.loo-bottom text:nth-child(1){
? margin-right: 15rpx;
? font-size:40rpx;
? color:#fe6400;

}
.loo-bottom text:last-child{
? font-size:20rpx;
? color:#4b3333;

}
.loo-bottom image{
? width: 35rpx;
? height: 35rpx;
? vertical-align: middle;
}
.lo-right{
? width: 50rpx;
? height: 50rpx;
}
.lo-right image{
? ?width: 50rpx;
? height: 50rpx;
}
.lo-right{
? margin-top:170rpx;
}
.active{
? color:aqua;
? border-bottom: 4rpx solid red;
}
.swiper-tab{
? width: 100%;
? border-bottom: 2rpx solid #ccc;
? text-align: center;
? height: 88rpx;
? line-height: 88rpx;
? font-weight: bold;
}

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 聊聊KeyCode被棄用后的問題

    聊聊KeyCode被棄用后的問題

    今天咱們就來聊聊KeyCode被棄用后的問題,希望對大家有所啟發(fā),如有錯誤或未考慮完全的地方,望不吝賜教
    2023-12-12
  • js獲取ip和地區(qū)

    js獲取ip和地區(qū)

    本文主要介紹了js獲取ip和地區(qū)的方法,具有很好的參考價值。下面跟著小編一起來看下吧
    2017-03-03
  • JavaScript AJAX之惰性載入函數(shù)

    JavaScript AJAX之惰性載入函數(shù)

    這篇文章主要介紹了JavaScript AJAX之惰性載入函數(shù),惰性載入表示函數(shù)執(zhí)行的分支僅會發(fā)生1次,是種JS的優(yōu)化技巧,需要的朋友可以參考下
    2014-08-08
  • JavaScript實現(xiàn)與web通信的方法詳解

    JavaScript實現(xiàn)與web通信的方法詳解

    這篇文章主要介紹了JavaScript實現(xiàn)與web通信的方法詳解,文章通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-08-08
  • javascript按順序加載運行js方法

    javascript按順序加載運行js方法

    本篇文章主要教給大家如何在javascript中動態(tài)加載按順序加載運行js的方法以及實現(xiàn)代碼,需要的朋友參考學(xué)習(xí)下吧。
    2017-12-12
  • JavaScript利用split函數(shù)按規(guī)定截取字符串(獲取郵箱用戶名)

    JavaScript利用split函數(shù)按規(guī)定截取字符串(獲取郵箱用戶名)

    這個其實就是利用了js的split函數(shù),以@分割數(shù)組,一般用這個的地方不多,但這個思路應(yīng)用的比較廣泛。推薦大家學(xué)習(xí)。
    2009-12-12
  • 學(xué)習(xí)JavaScript設(shè)計模式之享元模式

    學(xué)習(xí)JavaScript設(shè)計模式之享元模式

    這篇文章主要為大家介紹了JavaScript設(shè)計模式中的享元模式,對JavaScript設(shè)計模式感興趣的小伙伴們可以參考一下
    2016-01-01
  • JavaScript插件化開發(fā)教程 (三)

    JavaScript插件化開發(fā)教程 (三)

    前面我們學(xué)習(xí)了jQuery的方式開發(fā)插件,講訴的都是些基礎(chǔ)的理論知識,今天開始,我們就來實戰(zhàn)一下,學(xué)習(xí)開發(fā)自己的插件庫。
    2015-01-01
  • 前端實現(xiàn)批量下載并打包成ZIP文件的步驟及示例

    前端實現(xiàn)批量下載并打包成ZIP文件的步驟及示例

    下載我相信很多小伙伴并不陌生,下載文件的形式也有很多,下面這篇文章主要給大家介紹了關(guān)于前端實現(xiàn)批量下載并打包成ZIP文件的步驟及示例,文中通過代碼介紹的非常詳細,需要的朋友可以參考下
    2024-07-07
  • 微信小程序wxml列表渲染原理解析

    微信小程序wxml列表渲染原理解析

    這篇文章主要介紹了微信小程序wxml列表渲染原理解析,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2019-11-11

最新評論

萨嘎县| 绍兴市| 彭山县| 科尔| 沙坪坝区| 壶关县| 湄潭县| 西充县| 太和县| 若羌县| 湟源县| 伊吾县| 乐陵市| 新乐市| 湟中县| 虞城县| 巴中市| 荣成市| 赞皇县| 景德镇市| 辉南县| 阳城县| 慈溪市| 调兵山市| 白河县| 南昌县| 灵武市| 五原县| 湖口县| 固镇县| 东宁县| 乐陵市| 肇东市| 康保县| 日喀则市| 丰台区| 阜平县| 澄城县| 中江县| 荆州市| 永年县|