<template>
  <el-link :type="type" :icon="getIcon" :disabled="disabled" :underline="false" v-bind="$props" v-on="$listeners">
    <slot></slot>
    <th-icon v-if="isIconRight" :icon="icon" :type="type" :disabled="disabled" />
  </el-link>
</template>

<script>
import ThIcon from '../../icon/src/main'
export default {
  name: 'ThLink',
  components: {
    ThIcon
  },
  props: {
    // 链接类型
    type: {
      type: String,
      default: 'primary'
    },
    disabled: {
      type: Boolean,
      default: false
    },
    icon: {
      type: String,
      default: ''
    },
    isIconRight: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    getIcon() {
      if (this.icon) {
        return `el-icon-${this.icon} el-icon-th-${this.icon}`
      }
      return ''
    }
  }
}
</script>
