feat: 初始化
This commit is contained in:
40
components/CopyIcon/CopyIcon.vue
Normal file
40
components/CopyIcon/CopyIcon.vue
Normal file
@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<image :style="{ width: size + 'px', height: size + 'px', flexShrink: 0 }" src="/static/copy.svg" mode="aspectFit" @click="handleCopy"></image>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'CopyIcon',
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: ''
|
||||
},
|
||||
size: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 14
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCopy() {
|
||||
const that = this;
|
||||
uni.setClipboardData({
|
||||
data: this.value.toString(),
|
||||
success: function () {
|
||||
uni.showToast({
|
||||
title: that.$t('common.success.copy'),
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './index.scss';
|
||||
</style>
|
Reference in New Issue
Block a user