App.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <script>
  2. import Vue from 'vue';
  3. // 解析地址栏参数
  4. function getQueryVariable(variable) {
  5. // 从?开始获取后面的所有数据
  6. var query = window.location.search.substring(1);
  7. // 从字符串&开始分隔成数组split
  8. var vars = query.split('&');
  9. // 遍历该数组
  10. for (var i = 0; i < vars.length; i++) {
  11. // 从等号部分分割成字符
  12. var pair = vars[i].split('=');
  13. // 如果第一个元素等于 传进来的参的话 就输出第二个元素
  14. if (pair[0] == variable) {
  15. return pair[1];
  16. }
  17. }
  18. return undefined;
  19. }
  20. export default {
  21. onLaunch: function() {
  22. uni.getSystemInfo({
  23. success: function(e) {
  24. console.log(e);
  25. Vue.prototype.StatusBar = e.statusBarHeight;
  26. // #ifdef MP-WEIXIN
  27. let custom = wx.getMenuButtonBoundingClientRect();
  28. Vue.prototype.Custom = custom;
  29. Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight + 4;
  30. // #endif
  31. // #ifndef MP-WEIXIN
  32. Vue.prototype.CustomBar = 48
  33. // #endif
  34. //用来判断是否iphoneX类型的全面屏设备
  35. if (e.model.indexOf('iPhone X') == 0) {
  36. Vue.prototype.isIphoneX = 68;
  37. } else {
  38. Vue.prototype.isIphoneX = 0;
  39. }
  40. },
  41. });
  42. },
  43. onShow: function() {
  44. // console.log('App Show')
  45. },
  46. onHide: function() {
  47. // console.log('App Hide')
  48. }
  49. }
  50. </script>
  51. <style lang="scss">
  52. /*每个页面公共css */
  53. @import "uview-ui/index.scss";
  54. @import "styles/iconfont.css";
  55. </style>