newData() {
this.$jsonp('https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su', {
wd: this.inputVal, // 这是要百度搜索的字段
jsonp:'cb',
}).then(res=>{
console.log(res)
}).catch(err=>{
})
一定要在下面用 window.baidu.sug去接收 因为百度传过来是个函数,不然会报找不到该函数
window.baidu={};
window.baidu.sug=function(json){
console.log(json )
}
}
image.png