123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <template>
- <div id="app">
- <div class="head">
- <div class="logo">
- <img style="height: 40px;margin-top: 10px;" class="left nav-icon" src="https://x.cocorobo.cn/icons/logo.png" />
- <!-- <span
- style="
- font-size: 28px;
- font-family: 'GT Walsheim Pro Trial Bold';
- font-weight: bold;
- color: #fff;
- "
- >CocoBlockly</span
- > -->
- </div>
- </div>
- <div>
- <!-- main 内容 -->
- <keep-alive v-if="$route.meta.keepAlive">
- <!-- 这里是会被缓存的视图组件 -->
- <router-view v-if="$route.meta.keepAlive" />
- </keep-alive>
- <!-- 这里是不被缓存的视图组件 -->
- <router-view v-if="!$route.meta.keepAlive" />
- </div>
- </div>
- </template>
- <script>
- export default {
- name: "App",
- created() {
- //在页面加载时读取sessionStorage里的状态信息
- if (sessionStorage.getItem("store")) {
- this.$store.replaceState(
- Object.assign(
- {},
- this.$store.state,
- JSON.parse(sessionStorage.getItem("store"))
- )
- );
- }
- //在页面刷新时将vuex里的信息保存到sessionStorage里
- window.addEventListener("beforeunload", () => {
- sessionStorage.setItem("store", JSON.stringify(this.$store.state));
- });
- },
- };
- </script>
- <style>
- * {
- margin: 0;
- padding: 0;
- }
- body {
- font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
- "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
- }
- #app {
- height: 100%;
- width: 100%;
- /* background: #e6eaf0; */
- /* min-width: 1380px; */
- background: #fff;
- min-width: 1000px;
- }
- .head {
- height: 67.5px;
- width: 100%;
- background-color: #2c4fcd;
- display: flex;
- align-items: center;
- min-width: 1000px;
- }
- .logo {
- margin-left: 20px;
- }
- </style>
|