App.vue 680B

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