-
Notifications
You must be signed in to change notification settings - Fork 47
/
layout.vue
47 lines (41 loc) · 842 Bytes
/
layout.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!--
* @Author: fzf404
* @Date: 2022-08-12 10:39:12
* @LastEditors: fzf404 [email protected]
* @LastEditTime: 2022-10-03 18:47:22
* @Description: 布局切换
-->
<template>
<component :is="layout[store.layout]" :state="store"></component>
<router-view></router-view>
</template>
<script setup>
import { onMounted } from 'vue'
import { sendEvent } from '#/ipc'
import { storage } from '~/storage'
import maco from './maco.vue'
import wine from './wine.vue'
// 布局
const layout = {
maco,
wine,
}
const store = storage(
{
top: false, // 置顶
layout: 'maco', // 布局
theme: 'dark', //主题
},
{
top: (val) => {
sendEvent('win-top', val)
},
theme: (val) => {
document.body.classList = [val]
},
}
)
onMounted(() => {
document.body.classList = [store.theme]
})
</script>