App.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div id="app" :class="`theme${theme}`">
  3. <layout v-if="canUse"/>
  4. <div class="banbentips" v-else>
  5. <div>浏览器版内核版本过低,无法正常浏览网页,建议使用Chrome(谷歌)浏览器,Firefox(火狐)浏览器(版本号80或以上),360安全浏览器(版本10或以上)</div>
  6. <div>
  7. <p v-html="tips[0]"></p>
  8. <p v-html="tips[1]"></p>
  9. </div>
  10. <div>{{link}}</div>
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. import '@/assets/style/reset.less'
  16. import '@/assets/style/public.less'
  17. import '@/assets/theme/color.less'
  18. import layout from '@/views/layout/index.vue'
  19. import {mapState} from 'vuex'
  20. import broswer from './config/broswer'
  21. import whatBrowser from './config/core'
  22. export default {
  23. components:{
  24. layout
  25. },
  26. data(){
  27. return {
  28. broswer,
  29. link: window.location.href,
  30. tips:[],
  31. canUse:false
  32. }
  33. },
  34. methods:{
  35. changeColor(){
  36. document.getElementById('app').className = 'theme2'
  37. }
  38. },
  39. mounted(){
  40. this.tips = whatBrowser()
  41. if(broswer.trident){
  42. return this.canUse = false
  43. }
  44. // 火狐
  45. else if(broswer.gecko){
  46. let version = broswer.firefoxCore[1].split(".")[0]
  47. if(Number(version)<80)
  48. return this.canUse = false
  49. }
  50. // 谷歌
  51. else if(broswer.webKit){
  52. let version = broswer.chromeCore[1].split(".")[0]
  53. if(Number(version)<69)
  54. return this.canUse = false
  55. }
  56. this.canUse = true
  57. },
  58. computed:{
  59. ...mapState({
  60. theme: state => state.common.theme
  61. })
  62. }
  63. }
  64. </script>
  65. <style lang="less">
  66. #app {
  67. text-align: center;
  68. width: 100%;
  69. height: 100%;
  70. }
  71. .banbentips{
  72. color: #000;
  73. width: 100%;
  74. line-height: 2;
  75. }
  76. </style>