view.jsx 852 B

12345678910111213141516171819202122232425
  1. import { h, computed, withDirectives } from 'vue'
  2. import { formInputViewProps } from '../../form-input-props'
  3. import textareaDirective from '../../../directives/textarea'
  4. export default {
  5. props: formInputViewProps,
  6. inheritAttrs: false,
  7. setup (props) {
  8. const fontWeight = computed(() => {
  9. return props.config.fontWeight ?? 'normal'
  10. })
  11. const fontSize = computed(() => {
  12. return props.config.fontSize + 'px' ?? '12px'
  13. })
  14. const textAlign = computed(() => {
  15. return props.config.textAlign ?? 'left'
  16. })
  17. const width = computed(() => {
  18. return props.config.width ?? '100%'
  19. })
  20. return () => withDirectives(
  21. h('div', { style: { fontWeight: fontWeight.value, fontSize: fontSize.value, textAlign: textAlign.value, width: width.value} }),
  22. [[textareaDirective, props.modelValue]]
  23. )
  24. }
  25. }