-
-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Description
/**
- 恒温、恒湿控制列表请求
*/
export const useRequestControlTree = (spaceId: any, type = 'Temperature') => {
const { data, run } = useRequest(apiGetControlTree, {
manual: true,
pollingInterval: 5000
});
const controlTree = ref([]);
watch(data, (val: any) => {
if (val?.data) {
controlTree.value = val.data;
}
});
/**
- 请求控制树
*/
const requestControlTree = () => {
spaceId.value &&
run({
devTypeKeys: type === 'Temperature' ? ['S014', 'S015', 'S016'] : ['S030'], // 'S014' | 'S015' | 'S016' | 'S030'
spaceId: spaceId.value
});
};
watchEffect(() => {
if (spaceId.value) {
requestControlTree();
}
});
return {
controlTree,
requestControlTree
};
};
这样写会触发一直重复请求
Metadata
Metadata
Assignees
Labels
No labels