App.vue 677 B

1234567891011121314151617181920212223242526272829303132
  1. <!--
  2. * @Author: your name
  3. * @Date: 2021-10-14 17:17:53
  4. * @LastEditTime: 2022-03-09 11:41:56
  5. * @LastEditors: your name
  6. * @Description: In User Settings Edit
  7. * @FilePath: \Foshan4A\src\App.vue
  8. -->
  9. <template>
  10. <div id="app">
  11. <router-view />
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: 'App',
  17. watch: {
  18. $route: {
  19. // 监听路由变化 一级菜单时清除子路由缓存的数据
  20. handler: function (val) {
  21. const path = val.path.split('/')
  22. if (path.length <= 2) {
  23. sessionStorage.removeItem('collectionData')
  24. sessionStorage.removeItem('editIBMMQ')
  25. }
  26. },
  27. deep: true
  28. }
  29. }
  30. }
  31. </script>