Skip to content

Commit 5031aa9

Browse files
committed
feat: 增加加载时检测主题逻辑
1 parent 554eafa commit 5031aa9

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addLink } from '../../BootstrapBlazor/modules/utility.js'
1+
import { addLink, getTheme } from '../../BootstrapBlazor/modules/utility.js'
22
import { cerateDockview } from '../js/dockview-utils.js'
33
import Data from '../../BootstrapBlazor/modules/data.js'
44
import EventHandler from "../../BootstrapBlazor/modules/event-handler.js"
@@ -10,8 +10,15 @@ export async function init(id, invoke, options) {
1010
return;
1111
}
1212

13-
const dockview = cerateDockview(el, options)
14-
Data.set(id, { el, dockview });
13+
if(options.theme === 'dockview-theme-light') {
14+
let theme = getTheme();
15+
if (theme === 'dark') {
16+
options.theme = `dockview-theme-dark`;
17+
}
18+
}
19+
const dockview = cerateDockview(el, options);
20+
const updateTheme = e => dockview.switchTheme(e.theme);
21+
Data.set(id, { el, dockview, updateTheme });
1522

1623
dockview.on('initialized', () => {
1724
invoke.invokeMethodAsync(options.initializedCallback);

0 commit comments

Comments
 (0)