ant-design-vue/site/theme/template/IconDisplay/CopyableIcon.vue

35 lines
688 B
Vue
Raw Normal View History

2018-11-27 10:25:38 +00:00
<template>
2019-02-01 09:23:00 +00:00
<li
v-clipboard:copy="text"
v-clipboard:success="onCopied"
:class="justCopied === type ? 'copied' : ''"
>
<a-icon
:type="type"
:theme="theme"
/>
<span class="anticon-class">
<a-badge :dot="isNew">
{{ type }}
</a-badge>
</span>
</li>
2018-11-27 10:25:38 +00:00
</template>
<script>
export default {
props: ['type', 'isNew', 'theme', 'justCopied'],
data () {
2019-01-12 03:33:27 +00:00
const { type, theme } = this;
2018-11-27 10:25:38 +00:00
return {
text: theme === 'outlined' ? `<a-icon type="${type}" />` : `<a-icon type="${type}" theme="${theme}" />`,
2019-01-12 03:33:27 +00:00
};
2018-11-27 10:25:38 +00:00
},
methods: {
onCopied () {
2019-01-12 03:33:27 +00:00
this.$emit('copied', this.type, this.text);
2018-11-27 10:25:38 +00:00
},
},
2019-01-12 03:33:27 +00:00
};
2018-11-27 10:25:38 +00:00
</script>