vue resource jsonp请求
window.onload = function () {
var app = new Vue({
el: ".box",
data: {},
methods: {
get: function () {
this.$http.jsonp('https://sug.so.360.cn/suggest', {
params:{
word: 'a',
encodeout:'utf-8' //防止乱码
}
}).then(function (res) {
alert(res.data.s);
console.log(res.data.s);
}, function () {
alert('失败')
})
}
},
})
}
注意点:不要漏了params ;encodeout:'utf-8' 防止中文乱码