mirror of
https://gitee.com/wot-design-uni/wot-design-uni.git
synced 2025-12-07 17:48:34 +08:00
60 lines
1.3 KiB
Vue
60 lines
1.3 KiB
Vue
<!--
|
|
* @Author: weisheng
|
|
* @Date: 2023-03-09 19:23:03
|
|
* @LastEditTime: 2023-08-16 00:02:08
|
|
* @LastEditors: weisheng
|
|
* @Description:
|
|
* @FilePath: \wot-design-uni\src\App.vue
|
|
* 记得注释
|
|
-->
|
|
<script setup lang="ts">
|
|
import { onLaunch, onShow, onHide, onThemeChange } from '@dcloudio/uni-app'
|
|
import { useDark } from './store'
|
|
const darkMode = useDark()
|
|
|
|
onThemeChange((option) => {
|
|
darkMode.setDark(option.theme === 'dark')
|
|
})
|
|
|
|
onLaunch((ctx) => {
|
|
const systemInfo = uni.getSystemInfoSync()
|
|
darkMode.setDark(systemInfo.theme === 'dark')
|
|
|
|
// #ifdef H5
|
|
|
|
window.addEventListener('message', function (event) {
|
|
if (event.source !== parent) return
|
|
// 处理收到的消息
|
|
if (typeof event.data === 'boolean') {
|
|
darkMode.setDark(event.data)
|
|
} else {
|
|
darkMode.setDark(false)
|
|
}
|
|
})
|
|
// #endif
|
|
console.log('App Launch')
|
|
})
|
|
onShow(() => {
|
|
console.log('App Show')
|
|
})
|
|
onHide(() => {
|
|
console.log('App Hide')
|
|
})
|
|
</script>
|
|
<style lang="scss">
|
|
::-webkit-scrollbar {
|
|
width: 0;
|
|
height: 0;
|
|
}
|
|
|
|
page {
|
|
margin: 0;
|
|
padding: 0;
|
|
font-family: San Francisco, Rotobo, arial, PingFang SC, Noto SansCJK, Microsoft Yahei, sans-serif;
|
|
-webkit-font-smoothing: antialiased;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
font-size: 13px;
|
|
background: #f8f9fa;
|
|
}
|
|
</style>
|