import i18n from '@/i18n'

export default {
  name: 'TableTextComponent',
  props: {
    injectData: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      // for i18n inject:
      defaultText: i18n.t('viewdetail')
    }
  },
  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('button content:', this.injectData)
    return h('span', null, [h('el-button', { props: { type: 'text' }, style: { paddingLeft: 0 }, on: { click: this.emitClick } }, this.injectData.head?.buttonContent || this.defaultText)])
  }
}