只需要在app.vue里面写入以下代码
<template>
<div id="app">
<router-view />
</div>
</template>
<script>
export default {
data() {
return {};
},
created() {
if (sessionStorage.getItem("store")) {
this.$store.replaceState(
Object.assign(
{},
this.$store.state,
JSON.parse(sessionStorage.getItem("store"))
)
);
}
window.addEventListener("beforeunload", () => {
sessionStorage.setItem("store", JSON.stringify(this.$store.state));
});
}
};
</script>
<style>
body .el-table th.gutter {
display: table-cell !important;
}
/* #app{
min-width: 1280px
} */
</style>
<style lang="scss">
</style>