FieldError.vue 633 B

1234567891011121314151617181920212223242526272829
  1. <script setup>
  2. import { useValidationErrorIdGenerator } from '@/composables/helpers'
  3. const props = defineProps({
  4. error: {
  5. type: String,
  6. required: true
  7. },
  8. field: {
  9. type: String,
  10. required: true
  11. },
  12. alertType: {
  13. type: String,
  14. default: 'is-danger'
  15. }
  16. })
  17. const { valErrorId } = useValidationErrorIdGenerator(props.field)
  18. </script>
  19. <template>
  20. <div role="alert">
  21. <p :id="valErrorId"
  22. class="help"
  23. :class="alertType"
  24. v-html="error" />
  25. </div>
  26. </template>