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