graceIphonexBottom.vue 936 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <view>
  3. <view :class="['grace-iphonex-bottom', isFixed ? 'grace-iphonex-bottom-fixed' : '']" :style="{height:height, background:bgcolor}"></view>
  4. <view :style="{width:'100%', height:height}" v-if="isFixed"></view>
  5. </view>
  6. </template>
  7. <script>
  8. export default{
  9. props:{
  10. bgcolor : {
  11. type : String,
  12. default : '#FFFFFF'
  13. },
  14. isFixed : {
  15. type : Boolean,
  16. default : true
  17. }
  18. },
  19. data() {
  20. return {
  21. height:'0rpx'
  22. }
  23. },
  24. created : function () {
  25. var _self = this;
  26. // #ifdef MP
  27. uni.getSystemInfo({
  28. success: function(res) {
  29. var model = res.model;
  30. model = model.replace(' ', '');
  31. if (model.search('iPhoneX') != -1){
  32. _self.height = '50rpx';
  33. }
  34. }
  35. })
  36. // #endif
  37. }
  38. }
  39. </script>
  40. <style scoped>
  41. .grace-iphonex-bottom{width:100%; height:0rpx; flex:auto;}
  42. .grace-iphonex-bottom-fixed{position:fixed; z-index:999999; left:0; bottom:0;}
  43. </style>