var demo=new Vue({ el:'#app', data: { imgList:[], getImgUrl: '' //存數(shù)據(jù)接口 }, created: function(){ this.getImg() //定義方法 }, methods: { getImg: function(){ var that = this; that.$http({ //調(diào)用接口 method:'POST', url:"https://api.douban.com/v2/book/1220562" //this指data }).then(function(response){ //接口返回數(shù)據(jù) this.imgList=response.data; },function(error){ }) } } })寫一個練手的demo 但是提示vue如何解決跨域問題呢
vue-resource如何進行跨域的數(shù)據(jù)請求
慕仙森
2019-02-19 21:23:23