mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-26 04:39:53 +01:00
update: 通讯录初始化加载默认选中第一项
This commit is contained in:
parent
74def844f0
commit
ecf20300ff
1 changed files with 3 additions and 11 deletions
|
|
@ -290,8 +290,11 @@ export default {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Promise.all(agentPromises).then(() => {
|
Promise.all(agentPromises).then(() => {
|
||||||
|
const firstDevice = agentList[0] || {};
|
||||||
this.agentDeviceOptions = agentList;
|
this.agentDeviceOptions = agentList;
|
||||||
this.filteredAgents = agentList;
|
this.filteredAgents = agentList;
|
||||||
|
// 默认选中第一项
|
||||||
|
this.handleDeviceClick(firstDevice.devices?.[0] || {}, firstDevice);
|
||||||
// 获取设备状态
|
// 获取设备状态
|
||||||
this.fetchDeviceStatus();
|
this.fetchDeviceStatus();
|
||||||
});
|
});
|
||||||
|
|
@ -347,17 +350,6 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleAgentClick(agent) {
|
|
||||||
if (this.expandedAgentId === agent.id) {
|
|
||||||
this.expandedAgentId = null;
|
|
||||||
this.selectedAgent = null;
|
|
||||||
this.selectedDevice = null;
|
|
||||||
} else {
|
|
||||||
this.expandedAgentId = agent.id;
|
|
||||||
this.selectedAgent = agent;
|
|
||||||
this.selectedDevice = null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleDeviceClick(device, agent) {
|
handleDeviceClick(device, agent) {
|
||||||
this.expandedAgentId = agent.id;
|
this.expandedAgentId = agent.id;
|
||||||
this.selectedAgent = agent;
|
this.selectedAgent = agent;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue