-
-
Notifications
You must be signed in to change notification settings - Fork 91
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] Request option onFirst
.
#234
Comments
你可以自行写一个插件,类似这样的: export const onFistPlugin = definePlugin((queryInstance, options) => {
const isFist = ref(true)
return {
onSuccess(data) {
if (!isFist.value) {
return
}
options.onFirst?.(data)
isFist.value = false
}
}
})
--- example ---
useRequest(api, {
onFirst: data => { active.value = data[0] }
}, [onFistPlugin]) |
@John60676 Hi,看起来 https://www.attojs.com 里没有提到任何和插件相关的内容,搜索功能也搜不出来插件相关的章节,插件是非公开特性吗? |
只是文档没有写,但实际上是可以使用的。等我忙完这段时间文档我会补一下 |
关闭这个issue是因为需求已经可以通过plugin很好的解决,我在这里开了个新issue #242 以方便对插件文档的追踪 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
需求描述 Feature Description
比方说,我希望在第一次返回请求结果时给某个变量赋予一个初始值,我一般使用
vueuse
的一个函数以方便的实现这个效果。但大量的这种行为是繁琐的,我想这应该是一个常见的需求,因此希望轮子能自带这方面的支持,api看起来像这样:
建议的解决方案 Proposed Solution
其他信息 Other information
无
The text was updated successfully, but these errors were encountered: