App.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <div id="app" :dir="dir">
  3. <router-view />
  4. <progress-bar />
  5. <div v-if="userAgentTipShow" class="userAgentTips">
  6. <img src="./assets/userAgentWarning.png" width="32px" />
  7. <span>当前浏览器可能与网站不兼容!建议使用 chrome 浏览器获得最佳使用体验。</span>
  8. <img src="./assets/userAgentClose.png" width="16px" @click="handleClickUserAgent" />
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. import ProgressBar from '@/common/progress_bar/index.vue';
  14. export default {
  15. components: {
  16. ProgressBar
  17. },
  18. data() {
  19. return {
  20. dir: 'ltr',
  21. userAgentTipShow: false
  22. };
  23. },
  24. created() {
  25. // const lang_type = this.$store.state.user.language_type;
  26. // if (lang_type === 'AR') {
  27. // this.dir = 'rtl';
  28. // }
  29. this.handleUserAgentRoot();
  30. },
  31. methods: {
  32. handleUserAgentRoot() {
  33. if (!sessionStorage.getItem('useragent_root_close') && navigator.userAgent.indexOf('Chrome') === -1) {
  34. this.userAgentTipShow = true;
  35. }
  36. },
  37. handleClickUserAgent() {
  38. sessionStorage.setItem('useragent_root_close', true);
  39. this.userAgentTipShow = false;
  40. }
  41. }
  42. };
  43. </script>
  44. <style lang="scss" scoped>
  45. .userAgentTips {
  46. position: fixed;
  47. top: 62px;
  48. left: 50%;
  49. display: flex;
  50. align-items: center;
  51. justify-content: space-between;
  52. padding: 12px 16px 12px 8px;
  53. margin-left: -312px;
  54. font-size: 16px;
  55. line-height: 24px;
  56. background: #fff;
  57. border-radius: 8px;
  58. :nth-child(1) {
  59. margin-right: 8px;
  60. }
  61. :nth-child(3) {
  62. cursor: pointer;
  63. }
  64. }
  65. </style>