You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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