index.vue 1.1 KB
Newer Older
Nature's avatar
Nature committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
/**
 * @Author Think
 * @Date 2018/11/24
 */

<template>
  <div :class="{'h-ios': isIos}" class="h-view">
    <slot />
  </div>
</template>

<script>
import { detectOS } from '../../common/utils/index'

export default {
  name: 'HView',
  props: {
    fullScreen: {
      // 是否为全屏应用,全屏子应用此项需设为true
      type: Boolean,
      default: true,
    },
  },
  data () {
    return {
      isIos: false,
    }
  },
  created () {
    this.fullScreen && detectOS() === 'ios' && (this.isIos = true)
  },
}
</script>

<style lang="less" scoped>
.h-view {
  width: 100%;
  height: 100%;
Nature's avatar
Nature committed
39
  overflow: hidden;
JingChao's avatar
JingChao committed
40
  padding-bottom: 44px;
Nature's avatar
Nature committed
41 42
  // background-color: $bgColor;
}
JingChao's avatar
JingChao committed
43 44 45 46 47
.platform-ios{
  .h-view{
    padding-bottom: 64px;
  }
}
Nature's avatar
Nature committed
48 49 50

// iPhoneX适配
@media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
JingChao's avatar
JingChao committed
51 52 53 54
  .platform-ios {
    .h-view {
      padding-bottom: 120px;
    }
Nature's avatar
Nature committed
55 56 57 58 59
  }
}

// iPhoneX Max适配
@media only screen and (device-width: 414px) and (device-height: 896px) {
JingChao's avatar
JingChao committed
60 61 62 63
  .platform-ios {
    .h-view {
      padding-bottom: 120px;
    }
Nature's avatar
Nature committed
64 65 66
  }
}
</style>