mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-29 21:52:53 +08:00
refactor: 调整悬浮按钮代码实现
This commit is contained in:
parent
1c4fed4f01
commit
4576b44c29
@ -1,18 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="clip-float-btn">
|
<div class="clip-float-btn" @click="handleBtnClick">
|
||||||
<div @click="restoreDataBase">🧭</div>
|
<div>{{ props.icon }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
// const emit = defineEmits(['onBtnClick'])
|
const emit = defineEmits(['onBtnClick'])
|
||||||
// const handleBtnClick = () => emit('onBtnClick')
|
const handleBtnClick = () => emit('onBtnClick')
|
||||||
const restoreDataBase = () => {
|
const props = defineProps({
|
||||||
// 清空数据库
|
icon: {
|
||||||
const flag = window.confirm('确定要清空剪贴板记录吗?')
|
type: String,
|
||||||
if (flag) {
|
default: '🌎'
|
||||||
window.db.emptyDataBase()
|
|
||||||
updateShowList('all')
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -19,4 +19,7 @@
|
|||||||
background-color: @primary-color;
|
background-color: @primary-color;
|
||||||
transition: all 0.15s;
|
transition: all 0.15s;
|
||||||
}
|
}
|
||||||
|
div {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<ClipFloatBtn></ClipFloatBtn>
|
<ClipFloatBtn :icon="'🧭'" @onBtnClick="restoreDataBase"></ClipFloatBtn>
|
||||||
<ClipFullData
|
<ClipFullData
|
||||||
:isShow="fullDataShow"
|
:isShow="fullDataShow"
|
||||||
:fullData="fullData"
|
:fullData="fullData"
|
||||||
@ -67,6 +67,15 @@ const updateShowList = (type) => {
|
|||||||
window.toTop()
|
window.toTop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const restoreDataBase = () => {
|
||||||
|
// 清空数据库
|
||||||
|
const flag = window.confirm('确定要清空剪贴板记录吗?')
|
||||||
|
if (flag) {
|
||||||
|
window.db.emptyDataBase()
|
||||||
|
updateShowList('all')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const handleNavClick = (type) => {
|
const handleNavClick = (type) => {
|
||||||
updateShowList(type)
|
updateShowList(type)
|
||||||
offset.value = 0 // 重置懒加载偏移量
|
offset.value = 0 // 重置懒加载偏移量
|
||||||
@ -160,6 +169,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
} else if (ctrlKey || metaKey || isArrow || isEnter) {
|
} else if (ctrlKey || metaKey || isArrow || isEnter) {
|
||||||
// 仅有 Ctrl时 什么也不执行 (utools模拟执行粘贴时触发)
|
// 仅有 Ctrl时 什么也不执行 (utools模拟执行粘贴时触发)
|
||||||
|
e.preventDefault()
|
||||||
} else {
|
} else {
|
||||||
window.focus() // 其他键盘事件 直接聚焦搜索框
|
window.focus() // 其他键盘事件 直接聚焦搜索框
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user