App.vue 661B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. },created(){
  34. console.log("111111")
  35. },
  36. };
  37. </script>
  38. <style></style>