textarea-input.vue 728 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <template>
  2. <div class="input">
  3. <label>
  4. <span class="label"><slot></slot></span>
  5. <textarea :placeholder="placeholder"
  6. :class="{error: error}"
  7. v-bind:value="value"
  8. v-on:input="input"></textarea>
  9. </label>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. name: "textarea-input",
  15. props: ['value', 'placeholder', 'error'],
  16. methods: {
  17. input: function(event) {
  18. this.$emit('clearError', null);
  19. this.$emit('input', event.target.value)
  20. }
  21. }
  22. }
  23. </script>
  24. <style scoped>
  25. .label {
  26. font-size: 80%;
  27. }
  28. textarea {
  29. width: 100%;
  30. resize: none;
  31. }
  32. textarea.error {
  33. background-color: rgba(255, 0, 0, 0.3);
  34. border-color: var(--error);
  35. }
  36. </style>