-
Notifications
You must be signed in to change notification settings - Fork 0
/
13.get.html
49 lines (47 loc) · 1.08 KB
/
13.get.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="app">
{{msg}}
<button @click="getUser">发送数据</button>
<button @click="postUser">请求数据</button>
<button @click="getData">获取百度数据</button>
</div>
<script src="vue2.0.js"></script>
<script src="vue-resource.js"></script>
<script>
var vm=new Vue({
el:'#app',
data:{
msg:'',
},
methods:{
postUser(){
this.$http.post('/postUser',{name:'helloworld'}).then(function (res) {
console.log(res);
})
},
getUser(){
this.$http.get('./getUser').then(function (res) {
this.msg=res.body;
})
},
getData(){
this.$http.jsonp('https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/',{
params:{
wd:'b',
},
jsonp:'cb'
}).then(function (res) {
console.log(res);
})
}
}
})
</script>
</body>
</html>