-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: delete button put into more opers
- Loading branch information
1 parent
e0f3d7d
commit c16c3eb
Showing
5 changed files
with
136 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<template> | ||
<el-popover | ||
placement="bottom-end" | ||
:width="200" | ||
trigger="click" | ||
@click.prevent.stop="() => {}" | ||
> | ||
<template #reference> | ||
<div class="more-icon"> | ||
<div> | ||
<div v-for="item in [1, 2, 3]" :key="item" class="more-icon-dot"></div> | ||
</div> | ||
<div class="more-popup"></div> | ||
</div> | ||
</template> | ||
<!-- delete icon --> | ||
|
||
<div class="more-opers"> | ||
<div | ||
v-for="oper in opers" | ||
:key="oper.title" | ||
class="more-opers-item" | ||
@click.prevent.stop="() => handleClick(oper)" | ||
> | ||
{{ oper.title }} | ||
</div> | ||
</div> | ||
</el-popover> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { PropType } from "vue"; | ||
import { ElMessageBox } from "element-plus"; | ||
import { Oper } from "@/types/common"; | ||
export default { | ||
props: { | ||
opers: { | ||
type: Object as PropType<Oper[]>, | ||
default: [], | ||
}, | ||
}, | ||
setup() { | ||
const handleClick = (oper: Oper) => { | ||
if (oper.isConfirm) { | ||
ElMessageBox.confirm("delete this note?", "Warning", { | ||
confirmButtonText: "Yes", | ||
cancelButtonText: "No", | ||
type: "warning", | ||
}).then(() => { | ||
oper.onClick(); | ||
}); | ||
} else { | ||
oper.onClick(); | ||
} | ||
}; | ||
return { | ||
handleClick, | ||
}; | ||
}, | ||
}; | ||
</script> | ||
|
||
<style lang="less" scoped> | ||
.more-icon { | ||
position: absolute; | ||
top: 10px; | ||
right: 10px; | ||
cursor: pointer; | ||
padding: 5px; | ||
.more-icon-dot { | ||
width: 2px; | ||
height: 2px; | ||
color: #000; | ||
content: " "; | ||
border: 2px solid #999; | ||
border-radius: 2px; | ||
margin: 2px; | ||
} | ||
} | ||
.more-opers { | ||
.more-opers-item { | ||
cursor: pointer; | ||
user-select: none; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
export interface Coor { | ||
x: number; | ||
y: number; | ||
x: number; | ||
y: number; | ||
} | ||
|
||
export interface Rect { | ||
x: number; | ||
y: number; | ||
width: number; | ||
height: number; | ||
id?: string; | ||
} | ||
x: number; | ||
y: number; | ||
width: number; | ||
height: number; | ||
id?: string; | ||
} | ||
|
||
export interface Oper { | ||
title: string; | ||
onClick: () => void; | ||
isConfirm?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export interface Query { | ||
noteId: string; | ||
} | ||
noteId: string; | ||
} |