App.vue 824B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <div id="app">
  3. <!-- <img src="./assets/logo.png"> -->
  4. <!-- <div style="height: calc(100% + 1px)"><router-view v-if="isRouterAlive" /></div> -->
  5. <router-view v-if="isRouterAlive" />
  6. </div>
  7. </template>
  8. <script>
  9. export default {
  10. name: "App",
  11. provide() {
  12. return {
  13. reload: this.reload
  14. };
  15. },
  16. data() {
  17. return {
  18. isRouterAlive: true
  19. };
  20. },
  21. methods: {
  22. reload() {
  23. this.isRouterAlive = false;
  24. this.$nextTick(function() {
  25. this.isRouterAlive = true;
  26. });
  27. }
  28. },
  29. watch: {
  30. $route: function(to, from) {
  31. document.body.scrollTop = 0;
  32. document.documentElement.scrollTop = 0;
  33. }
  34. },
  35. created() {}
  36. };
  37. </script>
  38. <style lang="scss" scoped>
  39. #app {
  40. height: 100%;
  41. overflow-y: auto;
  42. border: 1px solid gainsboro;
  43. }
  44. </style>