mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-09 07:24:03 +08:00
feat: 添加从设置中读取operate的逻辑
This commit is contained in:
parent
d65668d4bb
commit
f97ee19319
@ -1,4 +1,5 @@
|
|||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
|
import setting from '../global/readSetting'
|
||||||
|
|
||||||
export default function useClipOperate({ emit }) {
|
export default function useClipOperate({ emit }) {
|
||||||
return {
|
return {
|
||||||
@ -37,13 +38,26 @@ export default function useClipOperate({ emit }) {
|
|||||||
window.remove(item)
|
window.remove(item)
|
||||||
emit('onDataRemove')
|
emit('onDataRemove')
|
||||||
} else if (id.indexOf('custom') !== -1) {
|
} else if (id.indexOf('custom') !== -1) {
|
||||||
console.log('custom')
|
const a = operation.command.split(':')
|
||||||
|
if (a[0] === 'redirect') {
|
||||||
|
utools.redirect(a[1], {
|
||||||
|
type: typeMap[item.type],
|
||||||
|
data: item.data
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
emit('onOperateExecute')
|
emit('onOperateExecute')
|
||||||
},
|
},
|
||||||
|
|
||||||
filterOperate: (operation, item, isFullData) => {
|
filterOperate: (operation, item, isFullData) => {
|
||||||
const { id } = operation
|
const { id } = operation
|
||||||
|
if (!isFullData) {
|
||||||
|
// 在非预览页 只展示配置在shown中的功能按钮 大小为 4
|
||||||
|
for (const sid of setting.operation.shown) {
|
||||||
|
if (id === sid) return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
if (id === 'copy') {
|
if (id === 'copy') {
|
||||||
return true
|
return true
|
||||||
} else if (id === 'view') {
|
} else if (id === 'view') {
|
||||||
@ -59,8 +73,15 @@ export default function useClipOperate({ emit }) {
|
|||||||
} else if (id === 'remove') {
|
} else if (id === 'remove') {
|
||||||
return true
|
return true
|
||||||
} else if (id.indexOf('custom') !== -1) {
|
} else if (id.indexOf('custom') !== -1) {
|
||||||
|
// 如果匹配到了自定义的操作 则展示
|
||||||
|
for (const m of operation.match) {
|
||||||
|
if (item.type === m) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user