### 说明:
~~~
官方已停止对VueResource进行更新 推荐使用axios 但axios不支持jsonp
~~~
~~~
Document{{title}}
new Vue({
//作用位置 el:""
el:"#test",
//数据
data:{
title:"三体",
url:"https://img1.doubanio.com/view/subject/m/public/s2768378.jpg"
},
//方法
methods: {
submit(event) { //成功的情况下执行的函数
var self = this;
let value = event.target.value;//获取输入框中的数据
let url = `https://api.douban.com/v2/movie/search?q=${value}&count=1`
console.log(value);
this.$http.jsonp(url).then(res=>{
this.handleData(res.body);
})
},
handleData(res){
console.log(res)
let title=res.subjects[0].title;
let url=res.subjects[0].images.small;
this.title=title;
this.url=url;
}
}
})
~~~