We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/**
const controlTree = ref([]); watch(data, (val: any) => { if (val?.data) { controlTree.value = val.data; } });
watchEffect(() => { if (spaceId.value) { requestControlTree(); } });
return { controlTree, requestControlTree }; }; 这样写会触发一直重复请求
The text was updated successfully, but these errors were encountered:
改成 watch(spaceId, () => { requestControlTree(); });
onMounted(() => { requestControlTree(); }); 这样就正常了
Sorry, something went wrong.
No branches or pull requests
/**
*/
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
};
};
这样写会触发一直重复请求
The text was updated successfully, but these errors were encountered: