recently wrote a small project in vue, and after writing a static page, I was ready to bind data and ran into a problem.
looks up how vue gets the data, and ends up using vue"s axios.
main.js Code:
:
:
postmanjquery
recently wrote a small project in vue, and after writing a static page, I was ready to bind data and ran into a problem.
looks up how vue gets the data, and ends up using vue"s axios.
main.js Code:
:
:
postmanjquery
the token value is empty and the data is returned. Save it and test it again.
another: data: data
if the data type is in JSON format in axios, then the header content-type
will be set to application/json
you can first check whether the body parsing method in the backend post method supports application/json
if it does not support application/json.
you can use the application/x-www-form-urlencoded;charset=utf-8
format
similar to the following, so the data is a string in xxx=yyy&xxxx=yyyy format (which will be placed in body)
axios.post(url, 'name=xxx&token=xxxxx')
is the traditional post submission method of jQuery