1
0
forked from dyf/APP

修复6155电量同步显示问题

This commit is contained in:
微微一笑
2025-11-21 11:07:10 +08:00
parent a28d4921a0
commit ac7e1873cd
2 changed files with 11 additions and 3 deletions

View File

@ -574,13 +574,22 @@
if (!json) {
return;
}
console.log("收到设备数据:", json);
let keys = Object.keys(json);
keys.forEach((key) => {
if (key in these.formData) {
these.formData[key] = json[key];
// 确保响应式更新
console.log(`更新字段 ${key}: ${these.formData[key]} -> ${json[key]}`);
these.$set(these.formData, key, json[key]);
} else {
console.log(`字段 ${key} 不在 formData 中,跳过更新`);
}
});
// 强制触发视图更新,确保电量显示同步
these.$forceUpdate();
console.log("更新后的电量:", these.formData.battary);
if (this.formData.battary <= 20) {
this.showPop({
message: "设备电量低",

View File

@ -476,8 +476,7 @@ class BleReceive {
let recCnt = recArr.find(v => {
return v.key.replace(/\//g, "").toLowerCase() === f.device.detailPageUrl.replaceAll(
'/', '').toLowerCase();
return v.key.replace(/\//g, "").toLowerCase() === f.device.detailPageUrl.replace(/\//g, '').toLowerCase();