The problem of vue2 cross-domain request

introduce axios.js

methods:
send () {

axios({
    method:"get",
    url:""
}).then(function(resp){
    console.log(resp);
}).catch(resp => {
    console.log("");
});

},

console error No "Access-Control-Allow-Origin" header is present on the requested resource. Origin" http://xxx.com" is therefore not allowed access.

you can request

normally with jquery"s $.getJSON ().
Sep.07,2021

Cross-domain request header need to configure Access-Control-Allow-Origin : ide does not need to do more processing: devserver-proxy


the development environment can configure agents locally to solve cross-domain
. Please refer to Seven
https://codeshelper.com/a/11.
of my previous article. The production environment needs to add response headers in the background Access-Control-Allow-Origin

the getJSON of jq uses jsonp's cross-domain solution. If the interface can be modified, it is recommended to set header, on the server. If you are using someone else's interface, use jsonp

.
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-1e58925-454c6.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-1e58925-454c6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?