Skip to content
New issue

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

[Feature Request] debounce 的过程中有类似loading的标记 #189

Open
johanninos opened this issue Mar 13, 2023 · 1 comment
Open

Comments

@johanninos
Copy link

需求描述 Feature Description

如果一个地方的加载跟两个 连续request有关, request1 成功后立刻发起request2.
由于request2 的防抖 导致 request2的loading有延迟, 导致两个loading 不连续。

建议的解决方案 Proposed Solution

debounce 等待过程中能否把loading先设置为true 或者有另一个值来表示(比如preLoading)。

其他信息 Other information

<div v-if="loading1 || loading2">loading...</div>
<div v-else>content</div>
const { loading: loading2, run } = useRequest(server2);
const { loading: loading1 } = useRequest(server1, {
	manual: false,
	onSuccess(res) {
		run(res);
	},
});

页面会经过会loading... => content => loading... => content。
虽然 debounceOptions: {leading: true} 可以解决问题, 但实际场景中 这与防抖的初衷不相符

@johanninos johanninos changed the title [Feature Request] [Feature Request] debounce 的过程中有类似loading的标记 Mar 13, 2023
@fcl999
Copy link

fcl999 commented Jun 28, 2024

感觉有必要, 现在我的解决方法是在执行 run() 前手动执行 loading.value = true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants