美文网首页
vue之跨域问题

vue之跨域问题

作者: 明明明明如月 | 来源:发表于2018-10-22 22:02 被阅读0次

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

<script src="vue.js" type="text/javascript" charset="utf-8"></script>

<script src="https://cdn.bootcss.com/vue-resource/1.5.1/vue-resource.min.js"></script>

</head>

<body>

<div id="app">

<button @click="tap()">点击我</button>

</div>

</body>

</html>

<script type="text/javascript">new Vue({

el: '#app',

data:{

list:''

},

methods: {

tap() {

//说明 vue文件在上面  resource文件在下面不可以改变方向

this.$http.jsonp("https://m.cncn.com/c/index_line_ajax.php?m=get&type_en=guonei",{

jsonp:'cb'

}).then(function(data){

console.log(data)

},function(){

})

}

}

})

</script>

相关文章

网友评论

      本文标题:vue之跨域问题

      本文链接:https://www.haomeiwen.com/subject/hmunzftx.html