fs-form.vue 731 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <view>
  3. <slot></slot>
  4. </view>
  5. </template>
  6. <script setup>
  7. import { provide } from 'vue'
  8. const props = defineProps({
  9. labelWidth: {
  10. type: String,
  11. default: '120rpx'
  12. },
  13. labelPosition: {
  14. type: String,
  15. default: 'left',
  16. validator(value) {
  17. return ['left', 'top'].includes(value)
  18. }
  19. },
  20. labelAlign: {
  21. type: String,
  22. default: 'left',
  23. validator(value) {
  24. return ['left', 'center', 'right', 'justify'].includes(value)
  25. }
  26. },
  27. errorType: {
  28. type: String,
  29. default: 'toast',
  30. validator(value) {
  31. return ['toast', 'message'].includes(value)
  32. }
  33. },
  34. model: Object
  35. })
  36. provide('form', props)
  37. defineExpose({
  38. model: props.model,
  39. errorType: props.errorType
  40. })
  41. </script>
  42. <style lang="scss">
  43. </style>