gui-iphone-bottom.vue 920 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <view :style="{height:height}" v-if="need"></view>
  3. </template>
  4. <script>
  5. export default{
  6. name : "gui-iphone-bottom",
  7. props : {
  8. height : {type:String, default:'50rpx'},
  9. isSwitchPage : {type:Boolean, default:false}
  10. },
  11. data() {
  12. return {
  13. need:false
  14. }
  15. },
  16. created:function(){
  17. // #ifdef MP
  18. this.setBottom();
  19. // #endif
  20. // #ifdef H5
  21. this.setBottom();
  22. // #endif
  23. },
  24. methods:{
  25. setBottom : function () {
  26. if(this.isSwitchPage){return ;}
  27. var system = uni.getSystemInfoSync();
  28. system.model = system.model.replace(' ', '');
  29. system.model = system.model.toLowerCase();
  30. var res1 = system.model.indexOf('iphonex');
  31. if(res1 > 5){res1 = -1;}
  32. var res2 = system.model.indexOf('iphone1');
  33. if(res2 > 5){res2 = -1;}
  34. if(res1 != -1 || res2 != -1){
  35. this.need = true;
  36. }
  37. }
  38. }
  39. }
  40. </script>
  41. <style scoped>
  42. </style>