Last active
January 5, 2022 11:11
-
-
Save lokize/dca1b7e9a33afabfa704b1ac314a0765 to your computer and use it in GitHub Desktop.
Vuejs
This file contains 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
<div v-if="!isMobile()"> | |
<desktop> | |
</desktop> | |
</div> | |
<div v-else> | |
<mobile> | |
</mobile> | |
</div> | |
methods: { | |
isMobile() { | |
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { | |
return true | |
} else { | |
return false | |
} | |
} | |
} | |
there is a syntax error after iPhone (| instead of ||) – |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment