api-client/components/firebase/inputform.vue

70 lines
1.3 KiB
Vue
Raw Normal View History

2020-01-20 16:55:48 +00:00
<template>
2020-01-22 01:57:38 +00:00
<div>
<ul>
<div class="show-on-large-screen">
<li>
<input
:aria-label="$t('label')"
type="text"
autofocus
v-model="message"
:placeholder="$t('paste_a_note')"
@keyup.enter="formPost"
/>
</li>
</div>
<div class="show-on-large-screen">
<li>
<input
:aria-label="$t('label')"
type="text"
autofocus
v-model="label"
:placeholder="$t('label')"
@keyup.enter="formPost"
/>
</li>
<button
class="icon"
:disabled="!(this.message || this.label)"
value="Save"
@click="formPost"
>
<i class="material-icons">add</i>
<span>Add</span>
</button>
</div>
2020-01-22 01:57:38 +00:00
</ul>
</div>
2020-01-20 16:55:48 +00:00
</template>
<style scoped lang="scss">
ul,
ol {
flex-direction: column;
}
</style>
2020-01-20 16:55:48 +00:00
<script>
import { fb } from "~/helpers/fb"
2020-01-20 16:55:48 +00:00
export default {
data() {
return {
2020-01-22 01:57:38 +00:00
message: null,
2020-02-24 18:44:50 +00:00
label: null,
}
2020-01-20 16:55:48 +00:00
},
methods: {
formPost() {
2020-02-02 03:01:06 +00:00
if (!(this.message || this.label)) {
2020-02-24 18:44:50 +00:00
return
2020-02-02 03:01:06 +00:00
}
2020-02-24 18:44:50 +00:00
fb.writeFeeds(this.message, this.label)
this.message = null
this.label = null
},
},
}
2020-01-20 16:55:48 +00:00
</script>