This commit is contained in:
fan
2021-01-31 19:58:27 +08:00
parent 3603d0c03b
commit 44c6063a03
24 changed files with 853 additions and 448 deletions
+6 -3
View File
@@ -1,6 +1,6 @@
<script>
const popoverCloseQueue = [];
const popoverCloseAll = () => popoverCloseQueue.forEach(callback => callback());
import contextmenu from "../directives/contextmenu";
const triggerEvents = {
hover(el) {},
focus(el) {
@@ -14,6 +14,7 @@ const triggerEvents = {
click(el) {
el.addEventListener("click", e => {
e.stopPropagation();
contextmenu.hide();
this.changeVisible();
});
},
@@ -59,7 +60,6 @@ export default {
style={this.popoverStyle}
on-click={e => e.stopPropagation()}
>
<div class="lemon-popover__title" />
<div class="lemon-popover__content">{this.$slots.content}</div>
<div class="lemon-popover__arrow" />
</div>
@@ -96,9 +96,12 @@ export default {
this.visible ? this.close() : this.open();
},
open() {
popoverCloseAll();
this.closeAll();
this.visible = true;
},
closeAll(){
popoverCloseQueue.forEach(callback => callback())
},
close() {
this.visible = false;
}