<template>
  <component
    :is="comTable.tableColumnName"
    :key="column.prop"
    :prop="column.prop"
    :label="column.label"
    :column-key="column.prop"
    :show-overflow-tooltip="column.showOverflowTooltip || column.overHidden"
    :align="column.align || comTable.tableOption.align"
    :header-align="column.headerAlign || comTable.tableOption.headerAlign"
    :fixed="vaildData(column.fixed, config.columnFixed)"
  >
    <template slot-scope="{ row, column: tableColumn, $index }">
      <slot
        :row="row"
        :tableColumn="tableColumn"
        :column="column"
        :index="$index"
        :size="comTable.isMediumSize"
        :label="row[column.prop]"
        :name="column.prop"
        v-if="comTable.$scopedSlots[column.prop]"
      ></slot>
      <template v-else>
        <span v-text="row[column.prop]"></span>
      </template>
    </template>
  </component>
</template>

<script>
import base from '../../utils/base.js';
import config from './config.js';

export default {
  name: 'column-slot',
  mixins: [base()],
  inject: ['comTable'],
  data: function () {
    return {
      config: config,
    };
  },
  components: {},
  props: {
    column: Object,
  },
  created() {},
  methods: {},
};
</script>

<style></style>
