增加自动扫描软件数据目录下style.css的功能
This commit is contained in:
parent
5dae561b70
commit
b6fcbad720
@ -8,6 +8,7 @@ const modules = {
|
|||||||
get_system_fonts: 'get_system_fonts',
|
get_system_fonts: 'get_system_fonts',
|
||||||
get_app_setting: 'get_app_setting',
|
get_app_setting: 'get_app_setting',
|
||||||
set_app_setting: 'set_app_setting',
|
set_app_setting: 'set_app_setting',
|
||||||
|
get_data_path: 'get_data_path'
|
||||||
},
|
},
|
||||||
player: {
|
player: {
|
||||||
invoke_play_music: 'play_music',
|
invoke_play_music: 'play_music',
|
||||||
|
|||||||
@ -4,6 +4,10 @@ import { getFonts } from '@main/utils/fontManage'
|
|||||||
|
|
||||||
// 公共操作事件(公共,只注册一次)
|
// 公共操作事件(公共,只注册一次)
|
||||||
export default () => {
|
export default () => {
|
||||||
|
mainHandle<string>(CMMON_EVENT_NAME.get_data_path, async() => {
|
||||||
|
return global.lxOldDataPath
|
||||||
|
})
|
||||||
|
|
||||||
mainHandle<LX.AppSetting>(CMMON_EVENT_NAME.get_app_setting, async() => {
|
mainHandle<LX.AppSetting>(CMMON_EVENT_NAME.get_app_setting, async() => {
|
||||||
return global.lx.appSetting
|
return global.lx.appSetting
|
||||||
})
|
})
|
||||||
|
|||||||
@ -18,12 +18,31 @@
|
|||||||
import { onMounted } from '@common/utils/vueTools'
|
import { onMounted } from '@common/utils/vueTools'
|
||||||
// import BubbleCursor from '@common/utils/cursor-effects/bubbleCursor'
|
// import BubbleCursor from '@common/utils/cursor-effects/bubbleCursor'
|
||||||
import useApp from '@renderer/core/useApp'
|
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()
|
useApp()
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
document.getElementById('root').style.display = 'block'
|
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)
|
// const styles = getComputedStyle(document.documentElement)
|
||||||
// window.lxData.bubbleCursor = new BubbleCursor({
|
// window.lxData.bubbleCursor = new BubbleCursor({
|
||||||
// fillStyle: styles.getPropertyValue('--color-primary-alpha-900'),
|
// fillStyle: styles.getPropertyValue('--color-primary-alpha-900'),
|
||||||
|
|||||||
@ -7,6 +7,10 @@ import { APP_EVENT_NAMES, DATA_KEYS, DEFAULT_SETTING } from '@common/constants'
|
|||||||
|
|
||||||
type RemoveListener = () => void
|
type RemoveListener = () => void
|
||||||
|
|
||||||
|
export const getDataPath = async() => {
|
||||||
|
return rendererInvoke(CMMON_EVENT_NAME.get_data_path)
|
||||||
|
}
|
||||||
|
|
||||||
export const getSetting = async() => {
|
export const getSetting = async() => {
|
||||||
return rendererInvoke<LX.AppSetting>(CMMON_EVENT_NAME.get_app_setting)
|
return rendererInvoke<LX.AppSetting>(CMMON_EVENT_NAME.get_app_setting)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user