App.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. <!--
  2. * @Author: aliyun0758874076 2300202994@qq.com
  3. * @Date: 2023-09-14 10:59:00
  4. * @LastEditors: aliyun0758874076 2300202994@qq.com
  5. * @LastEditTime: 2023-09-23 15:18:33
  6. * @FilePath: \jufeng-pc-settle\src\App.vue
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. -->
  9. <template>
  10. <div id="app">
  11. <router-view></router-view>
  12. </div>
  13. </template>
  14. <script>
  15. // import '../static/js/canvas-nest.min.js'
  16. export default {
  17. name: 'App',
  18. created () {
  19. // 在页面刷新时将vuex里的信息保存到localStorage里
  20. window.addEventListener('beforeunload', () => {
  21. localStorage.setItem('messageStore', JSON.stringify(this.$store.state))
  22. })
  23. // 在页面加载时读取localStorage里的状态信息
  24. localStorage.getItem('messageStore') && this.$store.replaceState(Object.assign(this.$store.state, JSON.parse(localStorage.getItem('messageStore'))))
  25. }
  26. }
  27. </script>
  28. <style lang="scss">
  29. html,body,#app{
  30. height: 100%;
  31. }
  32. </style>