You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/icon/icon.jsx

62 lines
1.1 KiB

7 years ago
export default {
name: 'AIcon',
7 years ago
props: {
prefixCls: {
default: 'anticon',
type: String,
},
type: String,
title: String,
spin: Boolean,
},
data () {
return {
}
},
computed: {
classes () {
const { prefixCls, type, spin } = this
return {
[`${prefixCls}`]: true,
[`${prefixCls}-${type}`]: type,
[`${prefixCls}-spin`]: !!spin || type === 'loading',
}
},
},
methods: {
handleClick (event) {
if (this.clicked) {
return
}
7 years ago
7 years ago
this.clicked = true
clearTimeout(this.timeout)
this.timeout = setTimeout(() => (this.clicked = false), 500)
this.$emit('click', event)
},
},
7 years ago
render () {
7 years ago
const { title, classes, handleClick, $listeners } = this
const iconProps = {
attrs: {
title,
},
class: classes,
on: {
...$listeners,
click: handleClick,
},
}
7 years ago
return (
7 years ago
<i {...iconProps}/>
7 years ago
)
},
7 years ago
beforeDestroy () {
if (this.timeout) {
clearTimeout(this.timeout)
}
},
}