fix(ApiTreeSelect): ApiTreeSelect组件首次调用会重复请求(#2940) (#3005)

由于watchEffect,onMounted会立即执行,所以导致重复请求。
并且 watch函数和watchEffect监听的依赖重复了,故删去
This commit is contained in:
invalid w 2023-09-07 21:47:55 +08:00 committed by GitHub
parent 89d7a19f3f
commit 607a24632a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,10 +60,6 @@
emit('change', ...args);
}
watchEffect(() => {
props.immediate && fetch();
});
watch(
() => props.params,
() => {
@ -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;