button logic

This commit is contained in:
Jiiks 2018-08-20 16:52:26 +03:00
parent 1a11eb6a6b
commit bc5eb1b5f0
1 changed files with 11 additions and 1 deletions

View File

@ -18,7 +18,7 @@
<div class="bd-notificationText">{{notifications[0].text}}</div>
</div>
<div class="bd-notificationFooter bd-flex">
<div class="bd-notificationBtn" v-for="(btn, index) in notifications[0].buttons">
<div class="bd-notificationBtn" v-for="(btn, index) in notifications[0].buttons" @click="() => buttonHandler(index)">
{{btn.text}}
</div>
</div>
@ -47,6 +47,16 @@
Notifications.dismiss(0);
this.dismissing = false;
}, 500);
},
buttonHandler(index) {
if (!this.notifications[0].buttons[index].onClick) return;
if (this.notifications[0].buttons[index].onClick()) {
this.dismissing = true;
setTimeout(() => {
Notifications.dismiss(0);
this.dismissing = false;
}, 500);
}
}
}
}