選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

FormInput.vue 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template lang="pug">
  2. .form-input
  3. h3(v-if='question.response_key_prompt == "name"') Welcome to Siimee Onboarding! Let's get started!
  4. span(v-if='question.response_key_prompt == "name"') Hi there, my {{ question.response_key_prompt }} is:
  5. input(v-if='question.response_key_prompt == "name"' placeholder='Jon Doe' type='text' v-model='input')
  6. span(v-if='question.response_key_prompt == "email"') My {{ question.response_key_prompt }} is:
  7. input(v-if='question.response_key_prompt == "email"' placeholder='jon_doe@generic_email.com' type='text' v-model='input')
  8. span(v-if='question.response_key_prompt == "password"') Please input a {{ question.response_key_prompt }}:
  9. input(v-if='question.response_key_prompt == "password"' placeholder='mysupersecretpassword' type='text' v-model='input')
  10. span(v-if='question.response_key_prompt == "zipcode"') What zipcode would you like to see results from?{{ question.response_key_prompt }}:
  11. input(v-if='question.response_key_prompt == "zipcode"' placeholder='99999' type='text' v-model='input')
  12. span(v-if='question.response_key_prompt == "blurb"') Please provide us with a short {{ question.response_key_prompt }} about yourself?:
  13. textarea(v-if='question.response_key_prompt == "blurb"' placeholder='I was born on a distant planet named Krypton, but was raised in a small town called SmallVille...' type='text' v-model='input' rows='4' cols='50')
  14. p(v-if='question.response_key_prompt == "image"')
  15. p Please Upload a Profile Image:
  16. button(@click='submitImage') Upload Image
  17. w-button.ma1.grow(@click='handleSubmit') NEXT
  18. </template>
  19. <script>
  20. export default {
  21. name: 'FormInput',
  22. props: {
  23. question: {
  24. required: true,
  25. type: Object,
  26. },
  27. },
  28. emits: ['update-answers'],
  29. data: () => ({
  30. input: null,
  31. }),
  32. methods: {
  33. handleSubmit() {
  34. if (this.question.response_key_prompt === 'password') {
  35. this.$emit('update-answers') // no password collection
  36. return
  37. }
  38. let payload = {
  39. question: this.question,
  40. answer: this.input,
  41. }
  42. this.$emit('update-answers', payload)
  43. },
  44. submitImage() {
  45. let payload = {
  46. question: this.question,
  47. answer: 'placeholder for image'
  48. }
  49. this.$emit('update-answers', payload)
  50. }
  51. },
  52. }
  53. </script>
  54. <style>
  55. h3 {
  56. text-align: center;
  57. }
  58. input {
  59. border: 0;
  60. outline: 0;
  61. background: transparent;
  62. border-bottom: 1px solid black;
  63. }
  64. </style>