|
@@ -6,7 +6,39 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
export default {
|
|
export default {
|
|
- name: 'App'
|
|
|
|
|
|
+ name: 'App',
|
|
|
|
+ computed: {
|
|
|
|
+ visitedViews() {
|
|
|
|
+ return this.$store.getters.visitedViews
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ this.beforeUnload()
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ beforeUnload() {
|
|
|
|
+ window.addEventListener('beforeunload', () => {
|
|
|
|
+ const tabViews = this.visitedViews.map(item => {
|
|
|
|
+ return {
|
|
|
|
+ fullPath: item.fullPath,
|
|
|
|
+ hash: item.hash,
|
|
|
|
+ meta: { ...item.meta },
|
|
|
|
+ name: item.name,
|
|
|
|
+ params: { ...item.params },
|
|
|
|
+ path: item.path,
|
|
|
|
+ query: { ...item.query },
|
|
|
|
+ title: item.title
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ sessionStorage.setItem('tabViews', JSON.stringify(tabViews))
|
|
|
|
+ })
|
|
|
|
+ // 页面初始化加载判断缓存中是否有数据
|
|
|
|
+ const oldViews = JSON.parse(sessionStorage.getItem('tabViews')) || []
|
|
|
|
+ if (oldViews.length > 0) {
|
|
|
|
+ this.$store.dispatch('tagsView/setVisitedViews', oldViews)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -14,14 +46,17 @@ export default {
|
|
.sy-content {
|
|
.sy-content {
|
|
margin: 15px;
|
|
margin: 15px;
|
|
}
|
|
}
|
|
|
|
+
|
|
.btn_custom_cancel {
|
|
.btn_custom_cancel {
|
|
float: right;
|
|
float: right;
|
|
margin-left: 10px !important;
|
|
margin-left: 10px !important;
|
|
}
|
|
}
|
|
|
|
+
|
|
.el-icon-delete {
|
|
.el-icon-delete {
|
|
color: red;
|
|
color: red;
|
|
}
|
|
}
|
|
-.el-icon-delete + span {
|
|
|
|
|
|
+
|
|
|
|
+.el-icon-delete+span {
|
|
color: red;
|
|
color: red;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|