Commit 62c1ee44 by Johannes Edmeier

Keep width when showing confirmation

parent 24f6f434
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
--> -->
<template> <template>
<button @click="click()" class="confirm-button" :class="{ 'is-warning' : confirm }" v-on-clickaway="abort"> <button @click="click" class="confirm-button" :class="{ 'is-warning' : confirm }" v-on-clickaway="abort">
<slot name="confirm" v-if="confirm">Confirm</slot> <slot name="confirm" v-if="confirm">Confirm</slot>
<slot v-else></slot> <slot v-else></slot>
</button> </button>
...@@ -37,7 +37,11 @@ ...@@ -37,7 +37,11 @@
}, },
click(event) { click(event) {
if (this.confirm) { if (this.confirm) {
event.target.style.width = null;
this.$emit('click', event); this.$emit('click', event);
} else {
const width = event.target.getBoundingClientRect().width;
event.target.style.width = `${width}px`;
} }
this.confirm = !this.confirm; this.confirm = !this.confirm;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment