mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-25 16:43:55 +08:00
update: 通讯录初始化加载默认选中第一项
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user