mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-16 04:46:55 +08:00
feat: 收藏功能完整实现
This commit is contained in:
parent
fcca51cd07
commit
5e07f667b7
@ -49,7 +49,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="clip-operate" v-show="activeIndex === index">
|
<div class="clip-operate" v-show="activeIndex === index">
|
||||||
<template v-for="{ id, title } of operation">
|
<template v-for="{ id, title } of operation">
|
||||||
<div :class="id" :title="title" @click.stop="handleOperateClick({ id, item })">
|
<div
|
||||||
|
v-if="id !== 'collect' || (id === 'collect' && item.collect !== true)"
|
||||||
|
:class="id"
|
||||||
|
:title="title"
|
||||||
|
@click.stop="handleOperateClick({ id, item })"
|
||||||
|
>
|
||||||
{{ title.slice(0, 1) }}
|
{{ title.slice(0, 1) }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -101,6 +106,8 @@ const handleOperateClick = ({ id, item }) => {
|
|||||||
window.copy(item)
|
window.copy(item)
|
||||||
break
|
break
|
||||||
case 'collect':
|
case 'collect':
|
||||||
|
item.collect = true // important
|
||||||
|
window.db.updateDataBaseLocal(db)
|
||||||
break
|
break
|
||||||
case 'remove':
|
case 'remove':
|
||||||
window.remove(item)
|
window.remove(item)
|
||||||
|
@ -39,7 +39,9 @@ const showList = ref([]) // 展示的数据
|
|||||||
const updateShowList = (type) => {
|
const updateShowList = (type) => {
|
||||||
// 更新显示列表
|
// 更新显示列表
|
||||||
showList.value = list.value
|
showList.value = list.value
|
||||||
.filter((item) => (type === 'all' ? item : item.type === type)) // 是 all则返回所有 否则按照 type返回
|
.filter((item) =>
|
||||||
|
type === 'collect' ? item.collect === true : type === 'all' ? item : item.type === type
|
||||||
|
) // 是 collect则返回所有收藏 否则按照 type返回
|
||||||
.filter((item) => (filterText.value ? item.type !== 'image' : item)) // 有过滤词 排除掉图片 DataURL
|
.filter((item) => (filterText.value ? item.type !== 'image' : item)) // 有过滤词 排除掉图片 DataURL
|
||||||
.filter(
|
.filter(
|
||||||
(item) =>
|
(item) =>
|
||||||
@ -48,6 +50,7 @@ const updateShowList = (type) => {
|
|||||||
: item // 无过滤词 返回全部
|
: item // 无过滤词 返回全部
|
||||||
)
|
)
|
||||||
.slice(0, GAP) // 重新切分懒加载列表
|
.slice(0, GAP) // 重新切分懒加载列表
|
||||||
|
console.log(showList.value)
|
||||||
window.toTop()
|
window.toTop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user