Skip to content

Commit

Permalink
fix: check global var
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuri Drabik committed Jul 28, 2019
1 parent 2c274c7 commit ad10033
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ class VueShopItem extends Vue {
@Prop({ default: true }) readonly showPreview!: boolean;
@Prop({ default: 'left' }) readonly previewPosition!: string;

isMobile() {
isMobile(): boolean | undefined {
if (!window) {
return;
}
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i
.test(navigator.userAgent);
.test(window.navigator.userAgent);
}
}

Expand Down

0 comments on commit ad10033

Please sign in to comment.