Skip to content

Commit d5b7689

Browse files
committed
fix(lock): automatic screen lock does not work
1 parent 785732f commit d5b7689

File tree

6 files changed

+92
-93
lines changed

6 files changed

+92
-93
lines changed

CHANGELOG.zh_CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- 修复黑暗主题刷新闪烁的白屏
1818
- 修复标签页关闭其他功能失效问题
1919
- 修复表单已知问题
20+
- 修复自动锁屏失效
2021

2122
## 2.3.0 (2021-04-10)
2223

src/App.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<ConfigProvider v-bind="lockEvent" :locale="getAntdLocale">
2+
<ConfigProvider :locale="getAntdLocale">
33
<AppProvider>
44
<RouterView />
55
</AppProvider>
@@ -11,7 +11,6 @@
1111
import { ConfigProvider } from 'ant-design-vue';
1212
import { AppProvider } from '/@/components/Application';
1313
14-
import { useLockPage } from '/@/hooks/web/useLockPage';
1514
import { useTitle } from '/@/hooks/web/useTitle';
1615
import { useLocale } from '/@/locales/useLocale';
1716
@@ -24,10 +23,7 @@
2423
// support Multi-language
2524
const { getAntdLocale } = useLocale();
2625
27-
// Create a lock screen monitor
28-
const lockEvent = useLockPage();
29-
30-
return { getAntdLocale, lockEvent };
26+
return { getAntdLocale };
3127
},
3228
});
3329
</script>

src/layouts/default/index.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<Layout :class="prefixCls">
2+
<Layout :class="prefixCls" v-bind="lockEvents">
33
<LayoutFeatures />
44
<LayoutHeader fixed v-if="getShowFullHeaderRef" />
55
<Layout :class="layoutClass">
@@ -26,6 +26,7 @@
2626
import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting';
2727
import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
2828
import { useDesign } from '/@/hooks/web/useDesign';
29+
import { useLockPage } from '/@/hooks/web/useLockPage';
2930
3031
import { useAppInject } from '/@/hooks/web/useAppInject';
3132
@@ -45,6 +46,10 @@
4546
const { getIsMobile } = useAppInject();
4647
const { getShowFullHeaderRef } = useHeaderSetting();
4748
const { getShowSidebar, getIsMixSidebar } = useMenuSetting();
49+
50+
// Create a lock screen monitor
51+
const lockEvents = useLockPage();
52+
4853
const layoutClass = computed(() => ({ 'ant-layout-has-sider': unref(getIsMixSidebar) }));
4954
5055
return {
@@ -54,6 +59,7 @@
5459
getIsMobile,
5560
getIsMixSidebar,
5661
layoutClass,
62+
lockEvents,
5763
};
5864
},
5965
});

src/main.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if (import.meta.env.DEV) {
2626
(async () => {
2727
const app = createApp(App);
2828

29-
// Configure vuex store
29+
// Configure store
3030
setupStore(app);
3131

3232
// Initialize internal system configuration
@@ -55,8 +55,4 @@ if (import.meta.env.DEV) {
5555
await router.isReady();
5656

5757
app.mount('#app', true);
58-
59-
if (import.meta.env.DEV) {
60-
window.__APP__ = app;
61-
}
6258
})();

types/global.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ declare global {
1616
};
1717
lastBuildTime: string;
1818
};
19-
declare interface Window {
20-
// Global vue app instance
21-
__APP__: App<Element>;
22-
}
19+
// declare interface Window {
20+
// // Global vue app instance
21+
// __APP__: App<Element>;
22+
// }
2323

2424
// vue
2525
declare type PropType<T> = VuePropType<T>;

0 commit comments

Comments
 (0)