由于watchEffect,onMounted会立即执行,所以导致重复请求。 并且 watch函数和watchEffect监听的依赖重复了,故删去
This commit is contained in:
parent
89d7a19f3f
commit
607a24632a
|
|
@ -60,10 +60,6 @@
|
||||||
emit('change', ...args);
|
emit('change', ...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
watchEffect(() => {
|
|
||||||
props.immediate && fetch();
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.params,
|
() => props.params,
|
||||||
() => {
|
() => {
|
||||||
|
|
@ -85,7 +81,7 @@
|
||||||
|
|
||||||
async function fetch() {
|
async function fetch() {
|
||||||
const { api } = props;
|
const { api } = props;
|
||||||
if (!api || !isFunction(api)) return;
|
if (!api || !isFunction(api) || loading.value) return;
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
treeData.value = [];
|
treeData.value = [];
|
||||||
let result;
|
let result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue