Skip to content

Commit

Permalink
fix(ApiTreeSelect): ApiTreeSelect组件首次调用会重复请求(vbenjs#2940) (vbenjs#3005)
Browse files Browse the repository at this point in the history
由于watchEffect,onMounted会立即执行,所以导致重复请求。
并且 watch函数和watchEffect监听的依赖重复了,故删去
  • Loading branch information
wangjue666 committed Sep 7, 2023
1 parent 89d7a19 commit 607a246
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/components/Form/src/components/ApiTreeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@
emit('change', ...args);
}
watchEffect(() => {
props.immediate && fetch();
});
watch(
() => props.params,
() => {
Expand All @@ -85,7 +81,7 @@
async function fetch() {
const { api } = props;
if (!api || !isFunction(api)) return;
if (!api || !isFunction(api) || loading.value) return;
loading.value = true;
treeData.value = [];
let result;
Expand Down

0 comments on commit 607a246

Please sign in to comment.