api-client/components/firebase/Inputform.vue

53 lines
1.1 KiB
Vue
Raw Normal View History

2020-01-20 16:55:48 +00:00
<template>
2020-12-11 10:29:03 +00:00
<div class="flex-col">
<div class="show-on-large-screen">
<input
:aria-label="$t('label')"
type="text"
autofocus
v-model="message"
:placeholder="$t('paste_a_note')"
@keyup.enter="formPost"
2020-12-11 16:54:34 +00:00
class="rounded-t-lg"
2020-12-11 10:29:03 +00:00
/>
</div>
2020-12-11 16:54:34 +00:00
<div class="border-b show-on-large-screen border-brdColor">
2020-12-11 10:29:03 +00:00
<input
:aria-label="$t('label')"
type="text"
autofocus
v-model="label"
:placeholder="$t('label')"
@keyup.enter="formPost"
/>
<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
</div>
2020-01-20 16:55:48 +00:00
</template>
<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>