App.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div id="app" :class="pcOrMobeil === 'PC' ? 'appClass' : '' " v-loading="loading">
  3. <!-- <img src="./assets/logo.png"> -->
  4. <router-view v-if="isRouterAlive"/>
  5. </div>
  6. </template>
  7. <script>
  8. // import commonHeader from '@/components/commonHeaders.vue'
  9. import DevicePixelRatio from '@/utils/device'
  10. export default {
  11. name: 'App',
  12. provide() {
  13. return {
  14. reload: this.reload
  15. }
  16. },
  17. components:{
  18. // commonHeader
  19. },
  20. data() {
  21. return {
  22. showHeader:false,
  23. pcOrMobeil: '',
  24. loading: true,
  25. isRouterAlive: true
  26. }
  27. },
  28. watch:{
  29. $route: {
  30. handler: function(route) {
  31. // route.path === '/index' || route.path === '/weather'
  32. this.showHeader = route.path === '/login' ? false : true
  33. },
  34. immediate: true
  35. }
  36. },
  37. created() {
  38. // new DevicePixelRatio().init()
  39. },
  40. mounted() {
  41. window.workSpaceVo = {}
  42. this.loadPage()
  43. this.isMobile()
  44. },
  45. methods:{
  46. loadPage() {
  47. setTimeout(() => {
  48. this.loading = false;
  49. }, 1000);
  50. },
  51. reload() {
  52. this.isRouterAlive = false
  53. this.$nextTick(() =>{
  54. this.isRouterAlive = true
  55. })
  56. },
  57. isMobile() {
  58. let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
  59. if (flag) {
  60. window.localStorage.setItem('isMobile', 'Mobile')
  61. this.pcOrMobeil = 'Mobile'
  62. } else {
  63. window.localStorage.setItem('isMobile', 'PC')
  64. this.pcOrMobeil = 'PC'
  65. }
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="less">
  71. @import "./assets/css/main.css";
  72. .el-overlay{
  73. .el-dialog{
  74. .el-dialog__header{
  75. .el-dialog__title{
  76. font-size: 14px;
  77. }
  78. }
  79. }
  80. }
  81. /* @import "./assets/css/color-dark.css"; */
  82. #app{
  83. /* background: #184FB4; */
  84. /* background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#005777), to(#005777), color-stop(0.2, #007aab),color-stop(0.8, #007aab)); */
  85. }
  86. .appClass{
  87. width: 100% ;
  88. height: 100%;
  89. overflow: hidden;
  90. }
  91. </style>