Last active
June 18, 2021 00:37
-
-
Save titusdecali/45f74fe25082d1fde710090c555e5ca4 to your computer and use it in GitHub Desktop.
Detect Desktop or Mobile Device in Vue
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
async mounted() { | |
// Detect if user is on Desktop or Mobile platform, then save to store | |
this.$isMobile() | |
? this.$store.commit('setPlatform', 'mobile') | |
: this.$store.commit('setPlatform', 'desktop') | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment