server.dev.js中配置为 app.use(’/finance/stock/hs’, proxy({target:‘http://web.juhe.cn:8080’,changeOrigin:true}));
调接口为:
axios({
method: ‘get’,
url: ‘/finance/stock/hs?gid=&type=0&key=1ed6d144683a32812ebe646f31a8e62e’
}).then(function (response) {
console.log(‘response’, response);
if (response.status == 200 ) {
}
}).catch(function (err) {
});
得到的返回是200,但是却是html,如下:
<!–html just for develop server–>
<!DOCTYPE html>
<html lang=“zh-cn”>
<head>
<meta charset=“UTF-8” />
<meta http-equiv=“X-UA-Compatible” content=“IE=edge,chrome=1”>
<meta name=“viewport” content=“width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0” />
<link rel=“stylesheet” href=“https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/tomorrow.min.css”>
<link rel=“stylesheet” href=“https://unpkg.com/[email protected]/build/pure-min.css” integrity=“sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w” crossorigin=“anonymous”>
<title>人傻钱多股票交易网</title>
</head>
<body>
<div id=“app”></div>
<script src="/dev/bundle.js"></script>
<!-- <script>
function loadScript(url, callback){
var script = document.createElement (“script”)
script.type = “text/javascript”;
if (script.readyState){
script.onreadystatechange = function(){
if (script.readyState == “loaded” || script.readyState == “complete”){
script.onreadystatechange = null;
callback();
}
};
} else {
script.onload = function(){ callback() };
}
script.src = url;
document.getElementsByTagName(“head”)[0].appendChild(script);
}
loadScript("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js", function(){
if (window.hljs) {
window.hljs.initHighlightingOnLoad();
}
});
</script> --> </body> </html>,求帮助,该怎么解决跨域问题
跨域不难的,网上找找,你这贴的根本看不出来