uniapp制作分类导航 左侧导航右侧内容 左侧导航可以纵向滚动右侧内容不动
时间: 2023-08-01 13:11:48 浏览: 296
30us
DHT11=0;
Delay10us(); //延时10us
DHT11=1;
}
可以使用uniapp的组件来实现这个需求,例如使用 `scroll-view` 组件来实现左侧分类导航的纵向滚动,再使用 `swiper` 或 `view` 组件来实现右侧内容的展示,这样uchar DHT11_Response()
{
uchar i;
uchar j;
j=0;
while((DHT11==1)&&(就可以实现左侧导航可以纵向滚动,右侧内容不动的效果。
以下是一个简单的j<200)) //等待DHT11响应
{
j++;
Delay10us();
}
if(j>=示例代码:
```html
<template>
<view class="container">
<scroll-view class="sidebar" scroll-y>
<!-- 左侧导航 -->
<view v-for="(item, index) in sidebarList" :key="index" class="sidebar-item200) //未响应
return 1;
else //响应成功
j=0;
while((DHT">{{ item.name }}</view>
</scroll-view>
<swiper class="content">
<!-- 右侧内容 -->
<swiper-item v-for="(item, index) in contentList" :key="index">{{ item.content }}</swiper-item>
</swiper>
</view>
11==0)&&(j<200)) //等待DHT11回应结束
{
j++;
Delay10us();
</template>
<script>
export default {
data() {
return {
sidebarList: [
{ name: '分类1' },
}
if(j>=200) //未回应结束
return 1;
else
return 0;
}
uchar D { name: '分类2' },
{ name: '分类3' },
{ name: '分类4' },
{ name: '分类5' }
],
contentList: [
{ content: '内容1' },
{ content: '内容HT11_ReadBit()
{
uchar i;
uchar j;
j=0;
while((DHT11==1)&&(j2' },
{ content: '内容3' },
{ content: '内容4' },
{ content: '内容5'<200)) //等待数据线变为0
{
j++;
Delay10us();
}
j=0;
}
]
}
}
}
</script>
<style>
.container {
display: flex;
height: 100vh;
}
.sidebar {
flex: 1;
background-color: #f0f0f0;
padding: 10px;
}
.sidebar-item while((DHT11==0)&&(j<200)) //等待数据线变为1
{
j++;
Delay {
line-height: 50px;
text-align: center;
}
.content {
flex: 3;
background-color: #fff;
padding: 20px;
}
</style>
```
其中,`scroll-view` 组件的 `scroll-y` 属性表示10us();
}
Delay10us();
i=0;
if(DHT11==1) //如果数据线仍为纵向滚动,`swiper` 和 `swiper-item` 组件用于实现右侧内容的展示。你可以根据自己的需求进行修改和优化。