JS 根据UA 加载不同样式
device.js
export function device () {
var u = navigator.userAgent
var isiOS = !!u.match(/(i[ ^;]+;( U;)? CPU.+Mac OS X/)
return isiOS
}
index.vue
<template>
<div id="app" v-if="getDataReady">
<div class="student-container" :class="[isIos ? 'is-ios' : 'is-andriod']">
</div>
</div>
</template>
<script>
import {device} from 'assets/js/device.js'
export default {
data () {
return {
isIos: true
},
mounted () {
if (device()) {
this.isIos = true
} else {
this.isIos = false
}
}
}
</script>
<style lang="stylus">
.is-ios
font-family DINCondensed-Bold
padding-top 1.6rem
.is-andriod
font-family MIUI_Bold
padding-top 1.42rem
</style>