伦理片hd-伦理片 在线播放-伦理片 在线-伦理免费在线观看-综合图片区-综合婷婷

訂閱本欄目 RSS您所在的位置: 深山工作室 > uni-app > 正文

uni-app一個像商城分類中心一樣的聯動側邊欄導航分類

2020/10/1 17:07:20 字體: 瀏覽 4862

<template>
<view>
<view class="ld">
<view class="left">
<scroll-view :scroll-y="true" :scroll-with-animation="true" :scroll-into-view="clickToId" :style="{ height: windowHeight }">
<view v-for="(item, index) in list" :key="index">
<view :class="['title', { active: index === currentNum }]" :id="'to' + index" @click="setId(index)">{{ item.title }}</view>
</view>
</scroll-view>
</view>
<view class="right">
<scroll-view :scroll-into-view="clickId" @scroll="scroll" :scroll-with-animation="true" :scroll-y="true" :style="{ height: windowHeight }">
<view v-for="(item, index) in list" :key="index">
<view class="title,right_title" :id="'po' + index">{{ item.title }}</view>
<view v-for="(it, idx) in item.list" :key="idx">
<text class="item">{{ it }}</text>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</template>

<script>
export default {
data() {
return {
list: [
{
title: '菜單1',
list: ['蓋飯1', '大白菜1', '土豆1', '西紅柿1', '辣椒1']
},
{
title: '菜單2',
list: ['蓋飯2', '大白菜2', '土豆2', '西紅柿2', '辣椒2']
},
{
title: '菜單3',
list: ['蓋飯3', '大白菜3', '土豆3', '西紅柿3', '辣椒3']
},
{
title: '菜單4',
list: ['蓋飯4', '大白菜4', '土豆4', '西紅柿4', '辣椒4']
},
{
title: '菜單5',
list: ['蓋飯5', '大白菜5', '土豆5', '西紅柿5', '辣椒5']
},
{
title: '菜單6',
list: ['蓋飯6', '大白菜6', '土豆6', '西紅柿6', '辣椒6']
},
{
title: '菜單7',
list: ['蓋飯7', '大白菜7', '土豆7', '西紅柿7', '辣椒7']
},
{
title: '菜單8',
list: ['蓋飯8', '大白菜8', '土豆8', '西紅柿8', '辣椒8']
},
{
title: '菜單9',
list: ['蓋飯9', '大白菜9', '土豆9', '西紅柿9', '辣椒9']
},
{
title: '菜單10',
list: ['蓋飯10', '大白菜10', '土豆10', '西紅柿10', '辣椒10']
},
{
title: '菜單11',
list: ['蓋飯11', '大白菜11', '土豆11', '西紅柿11', '辣椒11']
},
{
title: '菜單12',
list: ['蓋飯12', '大白菜12', '土豆12', '西紅柿12', '辣椒12']
},
{
title: '菜單13',
list: ['蓋飯13', '大白菜13', '土豆13', '西紅柿13', '辣椒13']
}
],
windowHeight: '0px',
clickId: '',
clickToId: '',
currentNum: 0,
topList: [],
isLeftClick: false
};
},
methods: {
setId(index) {
this.clickId = 'po' + index;
this.isLeftClick = true;
this.currentNum = index;
},
scroll(e) {
if (this.isLeftClick) {
this.isLeftClick = false;
return;
}
let scrollTop = e.target.scrollTop;
for (let i = 0; i < this.topList.length; i++) {
let h1 = this.topList[i];
let h2 = this.topList[i + 1];
if (scrollTop >= h1 && scrollTop < h2) {
this.currentNum = i;
this.clickToId = 'to' + i;
}
//解決滾動到最后選項左側不會選中
let length = this.topList.length;
if (scrollTop >= this.topList[length - 1]) {
this.currentNum = length - 1;
this.clickToId = 'to' + length - 1;
}
}
},
getNodesInfo() {
//獲取節點為.right_title距離頂部的距離,返回值放在數組中
const query = uni.createSelectorQuery().in(this);
query
.selectAll('.right_title')
.boundingClientRect()
.exec(res => {
console.log(res);
let nodes = res[0];
let rel = [];
nodes.map(item => {
rel.push(item.top);
});
console.log(rel);
this.topList = rel;
});
}
},
onLoad() {
let _that = this;
uni.getSystemInfo({
success: function(res) {
_that.windowHeight = res.windowHeight + 'px';
}
});
this.getNodesInfo();
}
};
</script>

<style lang="less">
.ld {
display: flex;

.left {
width: 160upx;
border-right: 1upx solid red;

.title {
text-align: center;
height: 100upx;
line-height: 100upx;
color: #000000;
}
.active {
background-color: #dd524d;
color: #ffffff;
}
}

.right {
flex: 1;

.title {
color: #dd524d;
padding: 20upx;
font-weight: 700;
}

.item {
padding-left: 20upx;
display: inline-block;
height: 350upx;
}
}
}
</style>

相關閱讀
ASP.NET常用的三十三種實用代碼(上)
XHTML+CSS兼容性解決方案小集
亂涂
利用aspJpeg組件生成多圖片水印組合時給加上透明水印圖片
吉林省觀光國際旅行社
紹興中僑旅游網
連云港紅發廊
利用javascript來靜態添加表格行
共有0條關于《uni-app一個像商城分類中心一樣的聯動側邊欄導航分類》的評論
發表評論
正在加載評論......
返回頂部發表評論
呢 稱:
表 情:
內 容:
評論內容:不能超過 1000 字,需審核,請自覺遵守互聯網相關政策法規。
驗證碼: 驗證碼 
網友評論聲明,請自覺遵守互聯網相關政策法規。

您發布的評論即表示同意遵守以下條款:
一、不得利用本站危害國家安全、泄露國家秘密,不得侵犯國家、社會、集體和公民的合法權益;
二、不得發布國家法律、法規明令禁止的內容;互相尊重,對自己在本站的言論和行為負責;
三、本站對您所發布內容擁有處置權。

更多信息>>欄目類別選擇
百度小程序開發
微信小程序開發
微信公眾號開發
uni-app
asp函數庫
ASP
DIV+CSS
HTML
python
更多>>同類信息
uni-app開發表單input組件的一些規則說明自己預留使用
uni-app:使用uni.downloadFile下載word或pdf文件并保存到手機
小程序中利用addPhoneContact將聯系人的信息添加到手機通訊錄支持保存聯系人頭像
微信小程序打開客服提示:該小程序提供的服務出現故障,請稍后重試
微信小程序客服會話只能過button讓用戶主動觸發
uni-app開發微信小程序使用button的open-type為contact調用微信客服不能用view或者js調用
更多>>最新添加文章
dw里面查找替換使用正則刪除sqlserver里面的CONSTRAINT
Android移動端自動化測試:使用UIAutomatorViewer與Selenium定位元素
抖音直播音掛載小雪花 懂車帝小程序
javascript獲取瀏覽器指紋可以用來做投票
火狐Mozilla Firefox出現:無法載入您的Firefox配置文件 它可能已經丟失 或是無法訪問 問題解決集合處理辦法
在Android、iOS、Windows、MacOS中微信小程序的文件存放路徑
python通過代碼修改pip下載源讓下載庫飛起
python里面requests.post返回的res.text還有其它的嗎
更多>>隨機抽取信息
rs操作數據表記錄集對象的方法
格式化金錢如果為0增加兩個小數點
新疆旅游在線
利用javascript高亮關鍵詞并且加上鏈接系列 2
深山旅行社管理系統開源嗎?
消聲器
主站蜘蛛池模板: 国产三级 在线播放 | 岛国大片在线观看免费版 | 久久夜夜视频 | 亚洲精品免费网站 | 日韩一区二区在线播放 | 特级毛片免费视频播放 | 欧美有码在线 | 啦啦啦手机在线播放视频 | 色婷婷综合久久久 | 国产成人精品本亚洲 | 日本乱妇 | 大伊香蕉在线精品视频人碰人 | 国产永久免费爽视频在线 | 欧美高清视频在线 | 欧美在线免费观看视频 | 欧美成人免费看片一区 | 4438亚洲最大 | 中文字幕日本久久2019 | 国产91在线免费观看 | 国产一级视频播放 | 四虎影视在线观看永久地址 | 亚洲欧美日本综合 | 精品免费tv久久久久久久 | 两个人的视频全免费观看在线 | 亚洲福利国产精品17p | 国产精品视频久久久久久 | 国产成人性毛片aaww | 九九这里有精品 | 4438x成人网最大色成网站 | 在线观看人成大片在线影院 | 欧美成a高清在线观看www | 点击进入不卡毛片免费观看 | 亚洲免费视频一区二区三区 | 亚洲人欧洲日韩 | 一级做a爰 | 国产精品夜夜春夜夜爽 | 国产成人自产拍免费视频 | 精品久久久噜噜噜久久7 | 香蕉视频国产在线观看 | 欧美xxxx黑人又粗又长 | 伊人网伊人 |