After vue2 upgrades to vue3, axios alway sends params with text/plain and the value is [object Object] ? #11994
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I upgraded vue2 to vue3, install [email protected] and installed same version of @vue/compat, and replace vue-template-compiler (if present) with @vue/compiler-sfc, folllowed by the document: https://v3-migration.vuejs.org/migration-build.html.
And create a global axios instance:
And set global instance with vue3 way:
Webpack config is
When I use the axios api get like this :
The axios always sends params with text/plain (Even though I set content-type with "application/json" in headers) and the url is like this, the value is [object Object]:
I guess there is something wrong about the encoding for vue compiler, or missing some config, but I have no idea.
Does someone know how to fix it ?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions