6170设备控制页面,滑块显示值

This commit is contained in:
fengerli
2025-07-15 19:00:53 +08:00
parent 388b462b57
commit 3349d09e46
2 changed files with 5 additions and 29 deletions

View File

@ -34,15 +34,6 @@
height: 88rpx; height: 88rpx;
position: relative; position: relative;
} }
uni-slider .uni-slider-value {
position: absolute;
color: rgba(255, 255, 255, 0.8);
font-size: 32rpx;
right: 2.5%;
top: -60rpx
}
.custom-file-picker .file-picker__box-content { .custom-file-picker .file-picker__box-content {
background: rgba(26, 26, 26, 1); background: rgba(26, 26, 26, 1);
border: none !important; border: none !important;

View File

@ -52,13 +52,14 @@
</view> </view>
<view class="info-row"> <view class="info-row">
<text class="info-label">灯光亮度</text> <text class="info-label">灯光亮度</text>
<text class="info-value status-running">%</text> <text class="info-value status-running">{{sliderValue}}%</text>
</view> </view>
<!-- 灯光亮度控制 --> <!-- 灯光亮度控制 -->
<view class="control-card"> <view class="control-card">
<slider :value="sliderValue" min="0" max="100" activeColor="rgb(187, 230, 0)" <slider :value="sliderValue" min="0" max="100" activeColor="rgb(187, 230, 0)"
backgroundColor="rgb(26, 26, 26)" show-value /> backgroundColor="rgb(26, 26, 26)" :show-value="false" @changing="onSliderChanging"
@change="onSliderChanging" />
</view> </view>
<!-- 灯光模式选择 --> <!-- 灯光模式选择 -->
@ -248,25 +249,9 @@
} }
}, },
methods: { methods: {
async initMQTT() { onSliderChanging(e) {
try { this.sliderValue = e.detail.value;
if (!isMQTTConnected()) {
await connectMQTT()
}
await publishMessage('/test/123/456/set', 'Hello MQTT!')
uni.showToast({
title: '消息发送成功'
})
} catch (error) {
console.error('发送失败:', error)
uni.showToast({
title: '发送失败',
icon: 'none'
})
}
}, },
selectMode(type) { selectMode(type) {
this.modeType = type; this.modeType = type;
this.lightModeA = true; this.lightModeA = true;