update: [UiField] 實作 displayDevice api
| | |
| | | export function isMobileDevice() { |
| | | let mobileDevices = ['Android', 'webOS', 'iPhone', 'iPad', 'iPod', 'BlackBerry', 'Windows Phone']; |
| | | console.log(navigator.userAgent); |
| | | export function isMobileDevice(): boolean { |
| | | const mobileDevices = ['Android', 'webOS', 'iPhone', 'iPad', 'iPod', 'BlackBerry', 'Windows Phone']; |
| | | return mobileDevices.some(e => navigator.userAgent.match(e)); |
| | | } |
| | | } |
| | |
| | | |
| | | <script lang="ts"> |
| | | import { Vue, Component, Prop } from 'vue-property-decorator'; |
| | | import { isMobileDevice } from '~/assets/ts/device'; |
| | | |
| | | @Component |
| | | export default class UiCarousel extends Vue { |
| | | export default class UiField extends Vue { |
| | | |
| | | @Prop() span!: number; |
| | | @Prop() icon!: string; |
| | |
| | | |
| | | currentDevice: 'MOBILE' | 'DESKTOP' = 'MOBILE'; |
| | | |
| | | mounted(): void { |
| | | this.currentDevice = isMobileDevice() ? 'MOBILE' : 'DESKTOP'; |
| | | } |
| | | |
| | | get fieldSpan(): number { |
| | | return this.span || 24; |
| | | } |