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

31 lines
644 B
Vue
Raw Normal View History

2018-11-27 10:25:38 +00:00
<template>
<li
2019-01-12 09:19:57 +00:00
:class="justCopied === type ? 'copied' : ''"
2018-11-27 10:25:38 +00:00
v-clipboard:copy="text"
v-clipboard:success="onCopied">
<a-icon :type="type" :theme="theme"/>
<span class='anticon-class'>
<a-badge :dot="isNew">
{{type}}
</a-badge>
</span>
</li>
</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>