|
@@ -5,14 +5,15 @@
|
|
|
theme="confirm"
|
|
|
ref="confirm"
|
|
|
trigger="click"
|
|
|
- @hide="confirm(false)"
|
|
|
>
|
|
|
<template #trigger>
|
|
|
<div @click.shift.stop="confirm(true)" @click.exact="confirm()">
|
|
|
<slot />
|
|
|
</div>
|
|
|
</template>
|
|
|
- <a @click.exact="confirm(true)"> Click to Confirm </a>
|
|
|
+ <a @click="confirm(null, $event)">
|
|
|
+ Click to Confirm
|
|
|
+ </a>
|
|
|
</tippy>
|
|
|
</template>
|
|
|
|
|
@@ -30,15 +31,28 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
- confirm(confirm) {
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
if (confirm === false) {
|
|
|
this.clickedOnce = false;
|
|
|
+ this.$refs.confirm.tip.hide();
|
|
|
} else if (confirm === true || this.clickedOnce === true) {
|
|
|
- this.$emit("confirm");
|
|
|
this.clickedOnce = false;
|
|
|
- } else {
|
|
|
- this.clickedOnce = true;
|
|
|
- }
|
|
|
+ this.$emit("confirm");
|
|
|
+ } else this.clickedOnce = true;
|
|
|
}
|
|
|
}
|
|
|
};
|