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

34 lines
697 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' : ''"
>
2019-09-28 12:45:07 +00:00
<a-icon :type="type" :theme="theme" />
2019-02-01 09:23:00 +00:00
<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'],
2019-09-28 12:45:07 +00:00
data() {
2019-01-12 03:33:27 +00:00
const { type, theme } = this;
2018-11-27 10:25:38 +00:00
return {
2019-09-28 12:45:07 +00:00
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: {
2019-09-28 12:45:07 +00:00
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>