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/site/components/IconSet/CopyableIcon.vue

38 lines
716 B

<template>
<li :class="justCopied ? 'copied' : ''" v-clipboard:copy="text"
v-clipboard:success="onCopied">
<a-icon :type="type" />
<span class='anticon-class'>
<a-badge :dot="isNew">
{{type}}
</a-badge>
</span>
</li>
</template>
<script>
import BaseMixin from 'antd/_util/BaseMixin'
export default {
mixins: [BaseMixin],
props: {
type: String,
isNew: Boolean,
},
data () {
return {
justCopied: false,
text: `<a-icon type="${this.type}" />`,
}
},
methods: {
onCopied () {
this.setState({ justCopied: true }, () => {
setTimeout(() => {
this.setState({ justCopied: false })
}, 2000)
})
},
},
}
</script>