-
-
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
[Need Help] 请求报错之后data被重置为undefined了 #82
Labels
Comments
这问题有待讨论一下 |
我个人认为报错了就恢复成初始化值就好了,不然我设置initialData之后又得判断一边是不是undefined,因为报错了就变成undefined了,导致别的错误 |
同意,我也遇到了同样的问题,对于 data 的那个 ref,我现在一直得配合着 vueuse 的 refDefault 来避免由于接口调用失败导致的不必要的错误。 不过我认为不一定要恢复成初始值,可以开放一个 global config,用于设置错误时的值处理策略,可以有三种
|
这个问题我们已经在 v2 版本处理了,目前 v2 版本已经发布 rc 版本。 欢迎试用。 文档:https://next.attojs.com 安装最新版本 $ npm install vue-request@next
# or
$ yarn add vue-request@next
# or
$ pnpm install vue-request@next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述 Problem Description
如上代码,在请求报错之后,data的值重置成undefined了,我觉得设置了
initialData
的话就变成initialData
好一点把。然后我加了下面的代码可以实现:The text was updated successfully, but these errors were encountered: