'admin-21.04.28:修复themeConfig.ts设置默认布局不生效的问题'

This commit is contained in:
lyt-Top 2021-04-28 20:20:53 +08:00
parent b240c9d8e9
commit 6517b843ae
2 changed files with 2 additions and 2 deletions

View File

@ -8,7 +8,7 @@
<script lang="ts"> <script lang="ts">
import { computed, onBeforeMount, onUnmounted, getCurrentInstance } from 'vue'; import { computed, onBeforeMount, onUnmounted, getCurrentInstance } from 'vue';
import { useStore } from '/@/store/index.ts'; import { useStore } from '/@/store/index.ts';
import { getLocal } from '/@/utils/storage.ts'; import { getLocal, setLocal } from '/@/utils/storage.ts';
import Defaults from '/@/views/layout/main/defaults.vue'; import Defaults from '/@/views/layout/main/defaults.vue';
import Classic from '/@/views/layout/main/classic.vue'; import Classic from '/@/views/layout/main/classic.vue';
import Transverse from '/@/views/layout/main/transverse.vue'; import Transverse from '/@/views/layout/main/transverse.vue';
@ -25,6 +25,7 @@ export default {
}); });
// () // ()
const onLayoutResize = () => { const onLayoutResize = () => {
if (!getLocal('oldLayout')) setLocal('oldLayout', getThemeConfig.value.layout);
const clientWidth = document.body.clientWidth; const clientWidth = document.body.clientWidth;
if (clientWidth < 1000) { if (clientWidth < 1000) {
getThemeConfig.value.isCollapse = false; getThemeConfig.value.isCollapse = false;

View File

@ -602,7 +602,6 @@ export default defineComponent({
}); });
// //
proxy.mittBus.on('layoutMobileResize', (res: any) => { proxy.mittBus.on('layoutMobileResize', (res: any) => {
if (getThemeConfig.value.layout === res.layout) return false;
getThemeConfig.value.layout = res.layout; getThemeConfig.value.layout = res.layout;
getThemeConfig.value.isDrawer = false; getThemeConfig.value.isDrawer = false;
initSetLayoutChange(); initSetLayoutChange();