/
new.ejs
40 lines (37 loc) · 989 Bytes
/
new.ejs
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
<div id="app">
<h1>Tasks - new</h1>
<hr />
<div class="form-group">
<label for="TopicTitle">タイトル</label>
<input type="text" class="form-control" id="title" v-model="title">
</div>
<div class="form-group">
<label for="TopicContent">content</label>
<textarea class="form-control" id="content" rows="3" v-model="content"></textarea>
</div>
<button v-on:click="send_post">投稿</button>
</div>
<!-- -->
<script>
new Vue({
el: '#app',
created () {
},
data: {
title:'',
content:''
},
methods: {
send_post(){
var task = {
'title': this.title,
'content': this.content
};
axios.post('/api/tasks_new' , task ).then(res => {
console.log(res.data );
window.location.href = '/tasks';
});
},
}
});
</script>