|
@@ -6,13 +6,14 @@
|
|
|
theme="confirm"
|
|
|
ref="confirm"
|
|
|
trigger="click"
|
|
|
- @hide="clickedOnce = false"
|
|
|
+ @onHide="clickedOnce = false"
|
|
|
+ @hide="delayedHide()"
|
|
|
>
|
|
|
- <div @click.shift.stop="confirm(true)" @click.exact="confirm()">
|
|
|
+ <div @click.shift.stop="confirm()" @click.exact="clickedOnce = true">
|
|
|
<slot ref="trigger" />
|
|
|
</div>
|
|
|
<template #content>
|
|
|
- <a @click="confirm(null, $event)">
|
|
|
+ <a @click="confirm($event)">
|
|
|
Click to Confirm
|
|
|
</a>
|
|
|
</template>
|
|
@@ -34,28 +35,25 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
- confirm(confirm, event) {
|
|
|
- if (confirm === null) {
|
|
|
- /* eslint-disable no-param-reassign */
|
|
|
- if (
|
|
|
- event &&
|
|
|
- event.type === "click" &&
|
|
|
- !event.altKey &&
|
|
|
- !event.ctrlKey &&
|
|
|
- !event.metaKey &&
|
|
|
- !event.shiftKey
|
|
|
- )
|
|
|
- confirm = true;
|
|
|
- else confirm = false;
|
|
|
- }
|
|
|
+ // eslint-disable-next-line no-unused-vars
|
|
|
+ confirm(event) {
|
|
|
+ if (
|
|
|
+ !event ||
|
|
|
+ event.type !== "click" ||
|
|
|
+ event.altKey ||
|
|
|
+ event.ctrlKey ||
|
|
|
+ event.metaKey ||
|
|
|
+ event.shiftKey
|
|
|
+ )
|
|
|
+ return;
|
|
|
|
|
|
- if (confirm === false) {
|
|
|
+ this.clickedOnce = false;
|
|
|
+ this.$emit("confirm");
|
|
|
+ },
|
|
|
+ delayedHide() {
|
|
|
+ setTimeout(() => {
|
|
|
this.clickedOnce = false;
|
|
|
- this.$refs.confirm.tip.hide();
|
|
|
- } else if (confirm === true || this.clickedOnce === true) {
|
|
|
- this.clickedOnce = false;
|
|
|
- this.$emit("confirm");
|
|
|
- } else this.clickedOnce = true;
|
|
|
+ }, 25);
|
|
|
}
|
|
|
}
|
|
|
};
|