优化mqtt协议代码
This commit is contained in:
@ -2,9 +2,9 @@
|
||||
<view class="container">
|
||||
<!-- 设备列表 -->
|
||||
<scroll-view class="device-list" scroll-y>
|
||||
<view class="device-card" v-for="(item, index) in deviceList" :key="index" @click="toggleSelect(index)">
|
||||
<view class="device-card" v-for="(item, index) in deviceList" :key="index" @click="item.onlineStatus === 1 ? toggleSelect(index) : null">
|
||||
<!-- 复选框 -->
|
||||
<view class="checkbox" :class="{ checked: item.checked }">
|
||||
<view class="checkbox" :class="{ checked: item.checked,disabled: item.onlineStatus !== 1 }">
|
||||
<uni-icons v-if="item.checked" type="checkmarkempty" size="18" color="rgb(0, 0, 0)"></uni-icons>
|
||||
</view>
|
||||
<!-- 设备信息 -->
|
||||
@ -71,6 +71,10 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onPullDownRefresh() {
|
||||
// 执行下拉刷新时的操作,比如重新获取数据
|
||||
this.getData();
|
||||
},
|
||||
/**
|
||||
* 获取设备状态(带自动轮询)
|
||||
* @param {number} val - 功能模式
|
||||
@ -419,4 +423,14 @@
|
||||
border-radius: 50rpx;
|
||||
width: 90%;
|
||||
}
|
||||
.checkbox.disabled {
|
||||
opacity: 0.5;
|
||||
background-color: rgba(255, 255, 255, 0.1) !important;
|
||||
border-color: rgba(255, 255, 255, 0.2) !important;
|
||||
pointer-events: none; /* 阻止点击事件 */
|
||||
}
|
||||
/* 可选:离线设备的卡片整体置灰 */
|
||||
.device-card[data-offline="true"] {
|
||||
opacity: 0.6;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user