<script lang="ts">
import { FormItem } from '../type'
import { PropType, h } from 'vue'
export default {
  name: 'FormateValue',
  props: {
    row: {
      type: Object,
      default: null
    },
    column: {
      type: Object as PropType<FormItem>,
      default: null
    }
  },
  setup(props, context) {
    const column: FormItem  = props.column
    const row = props.row
    switch (column.viewType) {
      case 'field': {
        return () => [
          h('span', {
            class: 'field'
          }, row[column.prop])
        ]
      }
      default: {
        return () => [
          h('span', {
            class: 'field'
          }, row[column.prop])
        ]
      }
    }
  }
}
</script>