mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-07 22:04:06 +08:00
fix: 删除某条历史记录时不再回到顶部
This commit is contained in:
parent
73be7b47df
commit
7893bbea48
@ -4,7 +4,7 @@
|
|||||||
<template v-for="tab of tabs">
|
<template v-for="tab of tabs">
|
||||||
<div
|
<div
|
||||||
:class="{ 'clip-switch-item': true, active: activeTab === tab.type }"
|
:class="{ 'clip-switch-item': true, active: activeTab === tab.type }"
|
||||||
@click="onNavClick(tab.type)"
|
@click="toggleNav(tab.type)"
|
||||||
>
|
>
|
||||||
<component :is="tab.icon"></component>
|
<component :is="tab.icon"></component>
|
||||||
{{ tab.name }}
|
{{ tab.name }}
|
||||||
@ -27,12 +27,7 @@ const tabs = [
|
|||||||
{ name: '收藏', type: 'collect', icon: Collection }
|
{ name: '收藏', type: 'collect', icon: Collection }
|
||||||
]
|
]
|
||||||
const activeTab = ref('all')
|
const activeTab = ref('all')
|
||||||
const emit = defineEmits(['onNavClick'])
|
|
||||||
const toggleNav = (type) => (activeTab.value = type)
|
const toggleNav = (type) => (activeTab.value = type)
|
||||||
const onNavClick = (type) => {
|
|
||||||
toggleNav(type)
|
|
||||||
emit('onNavClick', type)
|
|
||||||
}
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
tabs,
|
tabs,
|
||||||
activeTab,
|
activeTab,
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
@onDataRemove="handleDataRemove"
|
@onDataRemove="handleDataRemove"
|
||||||
@onOverlayClick="toggleFullData({ type: 'text', data: '' })"
|
@onOverlayClick="toggleFullData({ type: 'text', data: '' })"
|
||||||
></ClipFullData>
|
></ClipFullData>
|
||||||
<ClipSwitch ref="ClipSwitchRef" @onNavClick="handleNavClick">
|
<ClipSwitch ref="ClipSwitchRef">
|
||||||
<template #SidePanel>
|
<template #SidePanel>
|
||||||
<div class="clip-switch-btn-list" v-show="!isSearchPanelExpand">
|
<div class="clip-switch-btn-list" v-show="!isSearchPanelExpand">
|
||||||
<span class="clip-switch-btn clip-select-count" v-show="isMultiple">
|
<span class="clip-switch-btn clip-select-count" v-show="isMultiple">
|
||||||
@ -153,7 +153,7 @@ const textFilterCallBack = (item) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateShowList = (type) => {
|
const updateShowList = (type, toTop = true) => {
|
||||||
// 更新显示列表
|
// 更新显示列表
|
||||||
showList.value = list.value
|
showList.value = list.value
|
||||||
.filter((item) =>
|
.filter((item) =>
|
||||||
@ -162,7 +162,7 @@ const updateShowList = (type) => {
|
|||||||
.filter((item) => (filterText.value ? item.type !== 'image' : item)) // 有过滤词 排除掉图片 DataURL
|
.filter((item) => (filterText.value ? item.type !== 'image' : item)) // 有过滤词 排除掉图片 DataURL
|
||||||
.filter((item) => textFilterCallBack(item))
|
.filter((item) => textFilterCallBack(item))
|
||||||
.slice(0, GAP) // 重新切分懒加载列表
|
.slice(0, GAP) // 重新切分懒加载列表
|
||||||
window.toTop()
|
toTop && window.toTop()
|
||||||
}
|
}
|
||||||
|
|
||||||
const restoreDataBase = () => {
|
const restoreDataBase = () => {
|
||||||
@ -179,11 +179,6 @@ const restoreDataBase = () => {
|
|||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleNavClick = (type) => {
|
|
||||||
updateShowList(type)
|
|
||||||
offset.value = 0 // 重置懒加载偏移量
|
|
||||||
}
|
|
||||||
|
|
||||||
const fullData = ref({ type: 'text', data: '' })
|
const fullData = ref({ type: 'text', data: '' })
|
||||||
const fullDataShow = ref(false)
|
const fullDataShow = ref(false)
|
||||||
const toggleFullData = (item) => {
|
const toggleFullData = (item) => {
|
||||||
@ -197,7 +192,7 @@ const ClipSwitchRef = ref()
|
|||||||
const handleDataRemove = () => {
|
const handleDataRemove = () => {
|
||||||
// 此函数须在挂载后执行
|
// 此函数须在挂载后执行
|
||||||
list.value = window.db.dataBase.data
|
list.value = window.db.dataBase.data
|
||||||
updateShowList(ClipSwitchRef.value.activeTab)
|
updateShowList(ClipSwitchRef.value.activeTab, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const emit = defineEmits(['showSetting'])
|
const emit = defineEmits(['showSetting'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user