Blame view

node_modules/element-ui/packages/link/src/main.vue 915 Bytes
7820380e   “wangming”   1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  <template>
    <a
      :class="[
        'el-link',
        type ? `el-link--${type}` : '',
        disabled && 'is-disabled',
        underline && !disabled && 'is-underline'
      ]"
      :href="disabled ? null : href"
      v-bind="$attrs"
      @click="handleClick"
    >
  
      <i :class="icon" v-if="icon"></i>
  
      <span v-if="$slots.default" class="el-link--inner">
        <slot></slot>
      </span>
  
      <template v-if="$slots.icon"><slot v-if="$slots.icon" name="icon"></slot></template>
    </a>
  </template>
  
  <script>
  
  export default {
    name: 'ElLink',
  
    props: {
      type: {
        type: String,
        default: 'default'
      },
      underline: {
        type: Boolean,
        default: true
      },
      disabled: Boolean,
      href: String,
      icon: String
    },
  
    methods: {
      handleClick(event) {
        if (!this.disabled) {
          if (!this.href) {
            this.$emit('click', event);
          }
        }
      }
    }
  };
  </script>