App.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <script>
  2. import Vue from 'vue'
  3. export default {
  4. onLaunch: function () {
  5. Vue.prototype.cutoff = (msg, title = "", mask = false, exitTime = 0, icon = 'none', duration = 2000,) => {
  6. if (msg != '成功' || title) wx.showToast({
  7. title: msg == '成功' ? title : msg,
  8. duration,
  9. icon,
  10. mask: mask || exitTime,
  11. })
  12. if (exitTime && msg == '成功') setTimeout(uni.navigateBack, exitTime)
  13. return msg != '成功';
  14. };
  15. Vue.prototype.tovw = (num) => (num * 100 / 375).toFixed(3) + "vw";
  16. uni.getSystemInfo({
  17. success: function (e) {
  18. // #ifndef MP
  19. Vue.prototype.StatusBar = e.statusBarHeight;
  20. if (e.platform == 'android') {
  21. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  22. } else {
  23. Vue.prototype.CustomBar = e.statusBarHeight + 45;
  24. };
  25. // #endif
  26. // #ifdef MP-WEIXIN
  27. Vue.prototype.StatusBar = e.statusBarHeight;
  28. let custom = wx.getMenuButtonBoundingClientRect();
  29. Vue.prototype.Custom = custom;
  30. Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
  31. // #endif
  32. // #ifdef MP-ALIPAY
  33. Vue.prototype.StatusBar = e.statusBarHeight;
  34. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
  35. // #endif
  36. }
  37. })
  38. },
  39. onShow: function () {
  40. },
  41. onHide: function () {
  42. }
  43. }
  44. </script>
  45. <style lang="scss">
  46. @import "@/uni_modules/uview-ui/index.scss";
  47. @import "colorui/main.css";
  48. @import "colorui/icon.css";
  49. /* 你的项目css */
  50. @import "uni.scss";
  51. @import "static/iconfont/iconfont.css";
  52. </style>