mirror of https://github.com/ElemeFE/element
parent
868bbc71e7
commit
39fc1b29c4
|
@ -1,20 +1,3 @@
|
||||||
<template>
|
|
||||||
<transition :name="disableTransitions ? '' : 'el-zoom-in-center'">
|
|
||||||
<span
|
|
||||||
class="el-tag"
|
|
||||||
:class="[
|
|
||||||
type ? 'el-tag--' + type : '',
|
|
||||||
tagSize && `el-tag--${tagSize}`,
|
|
||||||
{'is-hit': hit}
|
|
||||||
]"
|
|
||||||
:style="{backgroundColor: color}">
|
|
||||||
<slot></slot>
|
|
||||||
<i class="el-tag__close el-icon-close"
|
|
||||||
v-if="closable"
|
|
||||||
@click.stop="handleClose"></i>
|
|
||||||
</span>
|
|
||||||
</transition>
|
|
||||||
</template>
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'ElTag',
|
name: 'ElTag',
|
||||||
|
@ -29,6 +12,7 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleClose(event) {
|
handleClose(event) {
|
||||||
|
event.stopPropagation();
|
||||||
this.$emit('close', event);
|
this.$emit('close', event);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -36,6 +20,20 @@
|
||||||
tagSize() {
|
tagSize() {
|
||||||
return this.size || (this.$ELEMENT || {}).size;
|
return this.size || (this.$ELEMENT || {}).size;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
render(h) {
|
||||||
|
const classes = [ 'el-tag', this.type ? `el-tag--${this.type}` : '',
|
||||||
|
this.tagSize ? `el-tag--${this.tagSize}` : '',
|
||||||
|
{'is-hit': this.hit}
|
||||||
|
];
|
||||||
|
const tagEl = (<span class={classes} style={{backgroundColor: this.color}}>
|
||||||
|
{ this.$slots.default }
|
||||||
|
{
|
||||||
|
this.closable && <i class="el-tag__close el-icon-close" on-click={this.handleClose}></i>
|
||||||
|
}
|
||||||
|
</span>);
|
||||||
|
|
||||||
|
return this.disableTransitions ? tagEl : <transition name="el-zoom-in-center">{ tagEl }</transition>;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue