-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSubmitBox.vue
75 lines (66 loc) · 1.95 KB
/
SubmitBox.vue
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<template>
<div class="section post">
<article class="media">
<figure class="media-left">
<p class="image is-64x64">
<img src="@/../public/images/avatars/molly.png">
</p>
</figure>
<div class="media-content">
<div class="content">
<div class="field">
<div class="control">
<input class="input" type="text" placeholder="Post title." v-model="title">
</div>
</div>
<div class="field">
<p class="control">
<textarea class="textarea" placeholder="Post body." v-model="content"></textarea>
</p>
</div>
<div>
<button @click.prevent="submitPost()" class="button is-info">Submit</button>
</div>
</div>
</div>
</article>
</div>
</template>
<script>
export default {
data: function () {
return {
title: '',
content: ''
}
},
methods: {
submitPost: function () {
var post = {
title: this.title,
content: this.content,
// TODO: create login system and set up below fields.
url: "#",
avatar: "./images/avatars/daniel.jpg",
submissionImage: "./images/submissions/image-yellow.png"
}
// create post.
this.$emit('submittedPost', post);
this.title = '';
this.content = '';
}
}
};
</script>
<style lang="scss" scoped>
.section {
padding: 0.5rem 1.5rem;
}
.media {
max-width: 600px;
margin: 0 auto;
border: 1px solid #e6e7e9;
padding: 1em 1.5em 0.5em 1.5em;
border-radius: 0.3em;
}
</style>