Axios cross-domain problem

1. I set

in main.js
axios.defaults.withCredentials=true
axios.defaults.crossDomain=true
axios.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded"

when used by other components, once with parameters such as

self.axios.post("http://pj.dianmila.com/supersolid/supersolid_api.php?a=list",{offset:self.swiperlen},{headers: {"Content-Type": "application/x-www-form-urlencoded"}}).then(function(res) {
                        var datajson = res.data;
..................
                            }
                        } 
                    }).catch(function (error) {
                    alert("")
                console.log(error);
            });

Why do you ask for advice

if you can"t cross-domain without the following headers setting?

2. When I set headers, the passed parameter is {"offset":5}. I want to directly offset:5, like ajax, which is not included in the object, how to implement it, and what configuration options should be added

topic description

sources of topics and their own ideas

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

May.12,2021

this is the backend data format post. Are there four commonly used Content-Type headers?
use form-data should meet your needs, but the backend supports this format


this is a problem of http cross-domain request rules. When the data you send is not a simple string, the request header header will change when it is numeric, and the request header will change to make a non-simple request. So the option pre-request will be sent in advance to ask the server whether to accept this format, and the post request will be made after the server confirms that it can receive it. Two solutions: 1. Let the backend open to accept the option request can be solved, 2. String serialization of json data before sending

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea5e8a-1d93.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea5e8a-1d93.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?