mixin.js 426 B

123456789101112131415161718192021
  1. export default {
  2. data() {
  3. return {
  4. isMobile: false,
  5. cacheHasNewVersion:false
  6. };
  7. },
  8. methods: {
  9. checkIsMob() {
  10. if (window.navigator.userAgent.match(
  11. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|IEMobile|MQQBrowser|JUC|Windows Phone)/i)) {
  12. return true;
  13. } else {
  14. return false;
  15. }
  16. }
  17. },
  18. mounted() {
  19. this.isMobile = this.checkIsMob();
  20. }
  21. };