-
Notifications
You must be signed in to change notification settings - Fork 0
/
15.leave.html
56 lines (56 loc) · 1.66 KB
/
15.leave.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
50
51
52
53
54
55
56
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="bootstrap.css">
</head>
<body>
<div id="app">
<div class="container">
<div class="row">
<div class="col-md-12">
<form role="form">
<div class="form-group">
<label for="title" class="control-label">标题</label>
<input type="text" class="form-control" v-model="title">
</div>
<div class="form-group">
<label for="title" class="control-label">内容</label>
<textarea class="form-control" v-model="content"></textarea>
</div>
<div>
<button class="btn btn-primary" @click="leave">添加留言</button>
</div>
</form>
<ul class="list-group">
<li class="list-group-item">
<p>标题</p>
<p>内容信息</p>
</li>
</ul>
</div>
</div>
</div>
</div>
<script src="vue2.0.js"></script>
<script src="vue-resource.js"></script>
<script>
var vm = new Vue({
el: '#app',
data: {
title: '',
content: '',
message: []
},
methods: {
leave(){
this.$http.post('/leaves', {title: this.title, content: this.content}).then(function (res) {
this.message = res.body;
})
}
}
})
</script>
</body>
</html>