Created
February 11, 2020 21:01
-
-
Save tamirvs/d1a584f3fc9c494cf75d3ca76c54fb1b to your computer and use it in GitHub Desktop.
Mixin to make the back button close dialogs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<v-dialog v-model="dialog"> | |
... | |
</v-dialog> | |
</template> | |
<script> | |
import backButton from './mixins/backButton.js'; | |
export default { | |
mixins: [ | |
backButton(['dialog']) | |
], | |
data: () => ({ | |
dialog: false | |
}) | |
} | |
</script> |
Hi @tamirvs, thanks for your solution, did you find a solution when we have no history ?
I ran into an issue where this wasn't working for me when the dialogs would appear on the first page load--with no prior vue-router navigations occurring.
I stumbled across this comment vuejs/vue-router#748 (comment) which points to https://forum.vuejs.org/t/router-beforeeach-if-manually-input-adress-in-browser-it-does-not-work/12461/3, which I don't fully understand but basically registering an empty beforeEach prior to creating my vue instance solved the issue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a temporary solution to vuetifyjs/vuetify#1793 (comment). Thanks @tamirvs