Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(theme): typo demo #1784

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading