wip: 临时提交
This commit is contained in:
21
src/App.vue
21
src/App.vue
@@ -1,15 +1,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { useTheme } from "@/composables/useTheme";
|
||||||
|
|
||||||
|
const { initTheme, toggleTheme } = useTheme();
|
||||||
|
|
||||||
onLaunch(() => {
|
onLaunch(() => {
|
||||||
console.log("App Launch");
|
// 应用启动时初始化主题
|
||||||
|
initTheme();
|
||||||
|
|
||||||
|
// 监听系统主题变化
|
||||||
|
uni.onThemeChange((res) => {
|
||||||
|
toggleTheme(res.theme);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
console.log("App Show");
|
// 应用显示时确保主题同步
|
||||||
});
|
initTheme();
|
||||||
|
|
||||||
onHide(() => {
|
|
||||||
console.log("App Hide");
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss"></style>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user