天波h5前端应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

App.vue 1.6KB

2 년 전
2 년 전
2 년 전
2 년 전
2 년 전
2 년 전
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <!--
  2. * @Date: 2022-01-19 10:08:26
  3. * @LastEditors: JinxChen
  4. * @LastEditTime: 2023-09-21 09:44:42
  5. * @FilePath: \TelpoH5FrontendWeb\src\App.vue
  6. * @description:
  7. -->
  8. <template>
  9. <div id="app">
  10. <router-view v-if="isRouterAlive" />
  11. </div>
  12. </template>
  13. <script>
  14. import { VERSION_MODEL } from './config/models';
  15. export default {
  16. provide() {
  17. return {
  18. reload: this.reload
  19. }
  20. },
  21. data() {
  22. return {
  23. isRouterAlive: true,
  24. }
  25. },
  26. mounted() {
  27. this.debug();
  28. console.log("当前版本号::", VERSION_MODEL, "当前环境::", process.env.NODE_ENV);
  29. },
  30. methods: {
  31. reload() {
  32. this.isRouterAlive = false;
  33. this.$nextTick(() => {
  34. this.isRouterAlive = true;
  35. });
  36. },
  37. debug() {
  38. if (process.env.NODE_ENV !== 'production') {
  39. const script = document.createElement('script');
  40. script.src = "//cdn.jsdelivr.net/npm/eruda";
  41. document.body.appendChild(script);
  42. script.onload = function () {
  43. try {
  44. window.eruda.init();
  45. } catch (e) {
  46. console.log(e);
  47. }
  48. }
  49. }
  50. }
  51. }
  52. }
  53. </script>
  54. <style lang="scss">
  55. #app {
  56. text-align: center;
  57. color: #2c3e50;
  58. height: 100vh;
  59. width: 100%;
  60. background-color: #f7f8fa;
  61. }
  62. </style>