<script>
import { defineComponent, h } from 'vue'
import { isString, isFunction } from '../utils/assist'

export default defineComponent({
  name: 'VRender',
  props: {
    render: [String, Function],
    data: Object
  },
  components: {},
  setup(props, context) {
    if (isString(props.render)) {
      return () => h('span', context.attrs, props.render)
    }
    if (isFunction(props.render)) {
      return () => {
        return props.render(props.data)
      }
    }
    return () => ''
  }
})
</script>

<style scoped></style>
