mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-07 22:04:06 +08:00
feat: 为每次复制添加toast提示
This commit is contained in:
parent
68d1e46870
commit
d48df53173
@ -60,6 +60,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import FileList from './FileList.vue'
|
||||
import ClipOperate from './ClipOperate.vue'
|
||||
import { dateFormat } from '../utils'
|
||||
@ -170,6 +171,10 @@ const handleItemClick = (ev, item) => {
|
||||
// 右键 仅复制
|
||||
window.copy(item)
|
||||
}
|
||||
ElMessage({
|
||||
message: '复制成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
}
|
||||
const activeIndex = ref(0)
|
||||
@ -214,6 +219,10 @@ onMounted(() => {
|
||||
// 如果侧栏中有数据 证明侧栏是打开的 不执行复制
|
||||
if (!props.isMultiple) {
|
||||
window.copy(props.showList[activeIndex.value])
|
||||
ElMessage({
|
||||
message: '复制成功',
|
||||
type: 'success'
|
||||
})
|
||||
} else {
|
||||
emit('onMultiCopyExecute', false)
|
||||
}
|
||||
@ -222,6 +231,10 @@ onMounted(() => {
|
||||
if (!props.isMultiple) {
|
||||
window.copy(props.showList[activeIndex.value])
|
||||
window.paste()
|
||||
ElMessage({
|
||||
message: '复制成功',
|
||||
type: 'success'
|
||||
})
|
||||
} else {
|
||||
emit('onMultiCopyExecute', true)
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
@ -58,6 +59,10 @@ const handleOperateClick = ({ id, item }) => {
|
||||
switch (id) {
|
||||
case 'copy':
|
||||
window.copy(item, false)
|
||||
ElMessage({
|
||||
message: '复制成功',
|
||||
type: 'success'
|
||||
})
|
||||
break
|
||||
case 'view':
|
||||
emit('onDataChange', item)
|
||||
|
@ -1,14 +1,15 @@
|
||||
import 'element-plus/theme-chalk/base.css'
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css'
|
||||
import 'element-plus/theme-chalk/el-overlay.css'
|
||||
import { ElButton, ElMessageBox } from 'element-plus'
|
||||
import { ElButton, ElMessageBox, ElMessage } from 'element-plus'
|
||||
|
||||
const components = [ElButton, ElMessageBox]
|
||||
const components = [ElButton, ElMessageBox, ElMessage]
|
||||
|
||||
export default function registerElement(app) {
|
||||
components.forEach((c) => {
|
||||
let name = transferCamel(c.name)
|
||||
if (name === 'message-box') name = 'el-message-box'
|
||||
if (c.name === 'MessageBox') name = 'el-message-box'
|
||||
if (c.name === 'message') name = 'el-message'
|
||||
require(`element-plus/theme-chalk/${name}.css`)
|
||||
app.component(name, c)
|
||||
})
|
||||
|
@ -58,7 +58,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, onMounted, computed, nextTick } from 'vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import { ElMessageBox, ElMessage } from 'element-plus'
|
||||
import ClipCard from '../cpns/ClipCard.vue'
|
||||
import ClipItemList from '../cpns/ClipItemList.vue'
|
||||
import ClipFullData from '../cpns/ClipFullData.vue'
|
||||
@ -119,6 +119,10 @@ const handleMultiCopyBtnClick = (isPaste) => {
|
||||
data: result
|
||||
})
|
||||
}
|
||||
ElMessage({
|
||||
message: '复制成功',
|
||||
type: 'success'
|
||||
})
|
||||
isPaste && window.paste()
|
||||
ClipItemListRef.value.emptySelectItemList()
|
||||
isMultiple.value = false
|
||||
@ -163,10 +167,16 @@ const updateShowList = (type) => {
|
||||
|
||||
const restoreDataBase = () => {
|
||||
// 清空数据库
|
||||
if (window.confirm('确定要清空剪贴板记录吗?')) {
|
||||
window.db.emptyDataBase()
|
||||
updateShowList('all')
|
||||
}
|
||||
ElMessageBox.confirm('确定要清空剪贴板记录吗', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
window.db.emptyDataBase()
|
||||
updateShowList('all')
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
const handleNavClick = (type) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user