Skip to content

Commit

Permalink
docs(theme): typo demo
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Mar 14, 2024
1 parent 502faee commit b805123
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
11 changes: 6 additions & 5 deletions packages/theme/docs/customize-theme.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,19 @@ Dynamically create a `link` tag, dynamically load style files into the applicati
> You can also use the [theme-btn](https://github.com/ng-alain/delon/tree/master/packages/theme/theme-btn/) component directly.
```ts
private readonly doc = inject(DOCUMENT);
changeTheme(theme: 'default' | 'dark'): void {
const el = this.doc.querySelector<HTMLLinkElement>('#dark-theme');
if (theme === 'dark') {
const style = document.createElement('link');
if (el) return;
const style = this.doc.createElement('link');
style.type = 'text/css';
style.rel = 'stylesheet';
style.id = 'dark-theme';
style.href = 'assets/style.dark.css';
this.doc.head.appendChild(style);
} else {
const dom = document.getElementById('dark-theme');
if (dom) {
dom.remove();
}
el?.remove();
}
}
```
Expand Down
13 changes: 6 additions & 7 deletions packages/theme/docs/customize-theme.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,23 @@ npx ng-alain-plugin-theme -t=themeCss
> 也可以直接使用 [theme-btn](https://github.com/ng-alain/delon/tree/master/packages/theme/theme-btn/) 组件。
```ts
private readonly doc = inject(DOCUMENT);
changeTheme(theme: 'default' | 'dark'): void {
const el = this.doc.querySelector<HTMLLinkElement>('#dark-theme');
if (theme === 'dark') {
const style = document.createElement('link');
if (el) return;
const style = this.doc.createElement('link');
style.type = 'text/css';
style.rel = 'stylesheet';
style.id = 'dark-theme';
style.href = 'assets/style.dark.css';
this.doc.head.appendChild(style);
} else {
const dom = document.getElementById('dark-theme');
if (dom) {
dom.remove();
}
el?.remove();
}
}
```



> 注意:如果你使用 `@delon/chart` 或第三方组件,可能需要手动修改组件来支持相应的主题。
## 组件开发问题
Expand Down

0 comments on commit b805123

Please sign in to comment.