This commit is contained in:
Folltoshe 2022-12-21 13:02:33 +08:00 committed by GitHub
commit 7da12e7d38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 1 deletions

View File

@ -8,6 +8,7 @@ const modules = {
get_system_fonts: 'get_system_fonts',
get_app_setting: 'get_app_setting',
set_app_setting: 'set_app_setting',
get_data_path: 'get_data_path'
},
player: {
invoke_play_music: 'play_music',

View File

@ -4,6 +4,10 @@ import { getFonts } from '@main/utils/fontManage'
// 公共操作事件(公共,只注册一次)
export default () => {
mainHandle<string>(CMMON_EVENT_NAME.get_data_path, async() => {
return global.lxOldDataPath
})
mainHandle<LX.AppSetting>(CMMON_EVENT_NAME.get_app_setting, async() => {
return global.lx.appSetting
})

View File

@ -19,12 +19,31 @@ import { onMounted } from '@common/utils/vueTools'
// import BubbleCursor from '@common/utils/effects/cursor-effects/bubbleCursor'
// import '@common/utils/effects/snow.min'
import useApp from '@renderer/core/useApp'
import { getDataPath } from '@renderer/utils/ipc'
import fs from 'fs'
import path from 'path'
function loadCss(path) {
const head = document.getElementsByTagName('head')[0]
const link = document.createElement('link')
link.type = 'text/css'
link.rel = 'stylesheet'
link.href = path
head.appendChild(link)
}
useApp()
onMounted(() => {
document.getElementById('root').style.display = 'block'
getDataPath().then(value => {
console.log(value)
// style.css
if (fs.existsSync(path.join(value + '/style.css'))) {
loadCss(path.join(value + '/style.css'))
console.log('Load style.css')
}
})
// const styles = getComputedStyle(document.documentElement)
// window.lxData.bubbleCursor = new BubbleCursor({
// fillStyle: styles.getPropertyValue('--color-primary-alpha-900'),

View File

@ -7,6 +7,10 @@ import { APP_EVENT_NAMES, DATA_KEYS, DEFAULT_SETTING } from '@common/constants'
type RemoveListener = () => void
export const getDataPath = async() => {
return rendererInvoke(CMMON_EVENT_NAME.get_data_path)
}
export const getSetting = async() => {
return rendererInvoke<LX.AppSetting>(CMMON_EVENT_NAME.get_app_setting)
}