<template>
  <el-link :disabled="disabled" :href="href" :icon="icon" :type="type" :underline="underline" :target="target" class="ed-link"
           @click="navTo">
    <slot>{{ text }}</slot>
  </el-link>
</template>

<script>
export default {
  name: "EdLink",
  props: {
    // 类型 primary / success / warning / danger / info
    type: {type: String, default: "default"},
    // 是否下划线
    underline: {type: Boolean, default: true},
    // 是否禁用状态
    disabled: Boolean,
    // 原生 href 属性
    href: String,
    // 图标类名
    icon: String,
    // 文字描述
    text: String,
    // 原生target, 规定在何处打开链接文档。
    target: {type: String, default: "_self"},
    // route
    to: {
      type: [String, Object],
    }
  },
  methods: {
    navTo() {
      if (this.to && !this.href) {
        this.$router.push(this.to)
      }
    }
  }
}
</script>

<style scoped>

</style>
