mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-08 06:16:18 +08:00
feat: fullData页内添加复制与分词功能 调整prop内容
This commit is contained in:
parent
52a3005d7e
commit
00ecb8f0f9
@ -1,12 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="clip-full-data">
|
<div class="clip-full-data">
|
||||||
<Transition name="fade">
|
<Transition name="fade">
|
||||||
<div class="clip-full" v-show="isShow">
|
<div class="clip-full-wrapper" v-show="isShow">
|
||||||
<div v-if="fullData.type === 'text'">
|
<div class="clip-full-operate-list">
|
||||||
<div v-text="fullData.data"></div>
|
<template v-for="{ id, name } of btns">
|
||||||
|
<div
|
||||||
|
class="clip-full-operate-list-item"
|
||||||
|
v-if="id !== 'word-split' || (id === 'word-split' && fullData.type !== 'file')"
|
||||||
|
@click="handleBtnClick(id)"
|
||||||
|
>
|
||||||
|
{{ name }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<template v-if="fullData.type === 'text'">
|
||||||
<FileList :data="fullData.data"></FileList>
|
<div class="clip-full-content" v-text="fullData.data"></div>
|
||||||
|
</template>
|
||||||
|
<div v-else class="clip-full-content">
|
||||||
|
<FileList :data="JSON.parse(fullData.data)"></FileList>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Transition>
|
</Transition>
|
||||||
@ -32,6 +43,28 @@ const props = defineProps({
|
|||||||
const emit = defineEmits(['onOverlayClick'])
|
const emit = defineEmits(['onOverlayClick'])
|
||||||
const onOverlayClick = () => emit('onOverlayClick')
|
const onOverlayClick = () => emit('onOverlayClick')
|
||||||
|
|
||||||
|
const btns = [
|
||||||
|
{
|
||||||
|
id: 'copy-all',
|
||||||
|
name: '📄 复制全部'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'word-split',
|
||||||
|
name: '🎁 智慧分词'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
const handleBtnClick = (id) => {
|
||||||
|
switch (id) {
|
||||||
|
case 'copy-all':
|
||||||
|
window.copy(props.fullData)
|
||||||
|
emit('onOverlayClick') // 退出侧栏
|
||||||
|
break
|
||||||
|
case 'word-split':
|
||||||
|
window.alert('增值服务 Comming Soon...')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
document.addEventListener('keydown', (e) => {
|
document.addEventListener('keydown', (e) => {
|
||||||
const { key } = e
|
const { key } = e
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.clip-full {
|
.clip-full-wrapper {
|
||||||
z-index: 9999999999;
|
z-index: 9999999999;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -11,9 +11,32 @@
|
|||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
div {
|
.clip-full-operate-list {
|
||||||
|
position: fixed;
|
||||||
|
top: 15px;
|
||||||
|
right: 30%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: @text-color;
|
||||||
|
&-item {
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
margin: 5px 5px;
|
||||||
|
background-color: @bg-color;
|
||||||
|
&:hover {
|
||||||
|
color: @bg-color;
|
||||||
|
background-color: @primary-color;
|
||||||
|
transition: all 0.15s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.clip-full-content {
|
||||||
background-color: @text-bg-color;
|
background-color: @text-bg-color;
|
||||||
padding: 10px;
|
padding: 20px;
|
||||||
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
width: 10px;
|
width: 10px;
|
||||||
|
@ -59,18 +59,13 @@ const handleNavClick = (type) => {
|
|||||||
offset.value = 0 // 重置懒加载偏移量
|
offset.value = 0 // 重置懒加载偏移量
|
||||||
}
|
}
|
||||||
|
|
||||||
const fullData = ref({ type: 'text', data: '' })
|
const fullData = ref({ type: 'text' })
|
||||||
const fullDataShow = ref(false)
|
const fullDataShow = ref(false)
|
||||||
const toggleFullData = (item) => {
|
const toggleFullData = (item) => {
|
||||||
// 是否显示全部数据 (查看全部)
|
// 是否显示全部数据 (查看全部)
|
||||||
const { type, data } = item
|
const { type } = item
|
||||||
// type: 'text' | 'file'
|
if (type === 'text' || type === 'file') {
|
||||||
if (type === 'text') {
|
fullData.value = item
|
||||||
fullData.value.type = 'text'
|
|
||||||
fullData.value.data = data
|
|
||||||
} else if (type === 'file') {
|
|
||||||
fullData.value.type = 'file'
|
|
||||||
fullData.value.data = JSON.parse(data)
|
|
||||||
}
|
}
|
||||||
fullDataShow.value = !fullDataShow.value
|
fullDataShow.value = !fullDataShow.value
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user