mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-12 06:57:11 +08:00
refactor: 优化日志筛选与文本复制
This commit is contained in:
28
src/components/TextCopy/index.vue
Normal file
28
src/components/TextCopy/index.vue
Normal file
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
<icon-copy :size="16" @click="copyText"/>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { Message } from "@arco-design/web-vue"
|
||||
interface Props{
|
||||
value:any
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {})
|
||||
const copyText=()=>{
|
||||
const textarea = document.createElement('textarea')
|
||||
textarea.value = props.value
|
||||
document.body.appendChild(textarea)
|
||||
textarea.select()
|
||||
document.execCommand('copy')
|
||||
document.body.removeChild(textarea)
|
||||
Message.success('复制成功')
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.content{
|
||||
display: inline-block;
|
||||
margin-left: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user