/**
 * @Author: lb
 * @CreateDate: 2022.8.8
 * @Modifier: 
 * @ModifiedDate: 
 * 表格里的文本组件
 * 一般用途：展示查看详情入口
 */
export default {
  name: 'TableTextComponent',
  props: {
    injectData: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      // for i18n inject:
      defaultText: '查看详情'
    }
  },
  methods: {
    emitClick() {
      console.log('inject data:' ,this.injectData)
      this.$emit('emit-data', {
        type: this.injectData.head?.actionName || 'view-detail-action',
        data: this.injectData.head?.emitFullData ? this.injectData : this.injectData.id
      })
    }
  },
  render: function (h) {
    // console.log(this)
    return h('span', null, [h('el-button', { props: { type: 'text' }, style: { paddingLeft: 0 }, on: { click: this.emitClick } }, this.injectData.buttonContent || this.defaultText)])
  }
}