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