inputform.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <div>
  3. <ul class="flex-col">
  4. <div class="show-on-large-screen">
  5. <li>
  6. <input
  7. :aria-label="$t('label')"
  8. type="text"
  9. autofocus
  10. v-model="message"
  11. :placeholder="$t('paste_a_note')"
  12. @keyup.enter="formPost"
  13. />
  14. </li>
  15. </div>
  16. <div class="show-on-large-screen">
  17. <li>
  18. <input
  19. :aria-label="$t('label')"
  20. type="text"
  21. autofocus
  22. v-model="label"
  23. :placeholder="$t('label')"
  24. @keyup.enter="formPost"
  25. />
  26. </li>
  27. <button
  28. class="icon"
  29. :disabled="!(this.message || this.label)"
  30. value="Save"
  31. @click="formPost"
  32. >
  33. <addIcon class="material-icons" />
  34. <span>Add</span>
  35. </button>
  36. </div>
  37. </ul>
  38. </div>
  39. </template>
  40. <script>
  41. import { fb } from "~/helpers/fb"
  42. import addIcon from "~/static/icons/add-24px.svg?inline"
  43. export default {
  44. components: { addIcon },
  45. data() {
  46. return {
  47. message: null,
  48. label: null,
  49. }
  50. },
  51. methods: {
  52. formPost() {
  53. if (!(this.message || this.label)) {
  54. return
  55. }
  56. fb.writeFeeds(this.message, this.label)
  57. this.message = null
  58. this.label = null
  59. },
  60. },
  61. }
  62. </script>