view.js 513 B

12345678910111213
  1. import { computed, h } from 'vue'
  2. import { formInputViewProps } from '../../form-input-props'
  3. import { useOptions } from '@cip/components/hooks/form-input'
  4. export default {
  5. props: formInputViewProps,
  6. setup (props) {
  7. const { options } = useOptions(props)
  8. const url = computed(() => {
  9. return options.value?.find(v => v.value === props.modelValue)?.url ?? ''
  10. })
  11. return () => h('img', { src: url.value, width: props.config.width ?? 20, style: 'vertical-align: middle;' })
  12. }
  13. }