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.

59 lines
1.2 KiB

8 months ago
  1. <template>
  2. <div id="app">
  3. <transition :name="$route.meta.transition">
  4. <keep-alive :include="cachedViews">
  5. <router-view class="router-view"/>
  6. </keep-alive>
  7. </transition>
  8. </div>
  9. </template>
  10. <script>
  11. export default {
  12. data() {
  13. return {
  14. query: {},
  15. version: '1.3.3',
  16. cachedViews: []
  17. }
  18. },
  19. created () {
  20. this.versionReload()
  21. },
  22. methods: {
  23. versionReload(){
  24. let version = this.version //版本号(每次上线前需要更新下版本号)
  25. console.log('最新系统版本: ',version)
  26. console.log('当前系统版本: ',this.version)
  27. let versionLocal = localStorage.getItem('_version_');
  28. if(version!=versionLocal){
  29. localStorage.setItem('_version_',version);
  30. this.version=versionLocal;
  31. location.reload();
  32. }
  33. }
  34. },
  35. watch: {
  36. $route(to) {
  37. if (to.meta.keepAlive) {
  38. this.cachedViews.push(to.name)
  39. }
  40. }
  41. }
  42. }
  43. </script>
  44. <style>
  45. .instant-enter-active,
  46. .instant-leave-active {
  47. transition: none !important;
  48. }
  49. .router-view {
  50. position: absolute;
  51. width: 100%;
  52. backface-visibility: hidden;
  53. contain: content;
  54. }
  55. </style>