Skip to content

Commit 769f74c

Browse files
feat(module:qr-code): support standalone component (#8228)
1 parent b62ac64 commit 769f74c

File tree

4 files changed

+39
-40
lines changed

4 files changed

+39
-40
lines changed

components/qr-code/doc/index.en-US.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ import { NzQRCodeModule } from 'ng-zorro-antd/qr-code';
1818

1919
## API
2020

21-
### nz-qrcode
22-
23-
| Property | Description | Type | Default |
24-
|-----------------------|-------------------------------------|---------------------------------|-----------|
25-
| `[nzValue]` | scanned link | `string` | - |
26-
| `[nzColor]` | QR code Color | `string` | `#000` |
27-
| `[nzBgColor]` | QR code background color | `string` | `#FFFFFF` |
28-
| `[nzSize]` | QR code Size | `number` | `160` |
29-
| `[nzPadding]` | QR code Padding | `number \| number[]` | `0` |
30-
| `[nzIcon]` | Icon address in QR code | `string` | - |
31-
| `[nzIconSize]` | The size of the icon in the QR code | `number` | `40` |
32-
| `[nzBordered]` | Whether has border style | `boolean` | `true` |
33-
| `[nzStatus]` | QR code status | `'active'|'expired' |'loading'` | `active` |
34-
| `[nzLevel]` | Error Code Level | `'L'|'M'|'Q'|'H'` | `M` |
35-
| `(nzRefresh)` | callback | `EventEmitter<string>` | - |
21+
### nz-qrcode:standalone
22+
23+
| Property | Description | Type | Default |
24+
| -------------- | ----------------------------------- | --------------------------------- | --------- |
25+
| `[nzValue]` | scanned link | `string` | - |
26+
| `[nzColor]` | QR code Color | `string` | `#000` |
27+
| `[nzBgColor]` | QR code background color | `string` | `#FFFFFF` |
28+
| `[nzSize]` | QR code Size | `number` | `160` |
29+
| `[nzPadding]` | QR code Padding | `number \| number[]` | `0` |
30+
| `[nzIcon]` | Icon address in QR code | `string` | - |
31+
| `[nzIconSize]` | The size of the icon in the QR code | `number` | `40` |
32+
| `[nzBordered]` | Whether has border style | `boolean` | `true` |
33+
| `[nzStatus]` | QR code status | `'active'|'expired' |'loading'` | `active` |
34+
| `[nzLevel]` | Error Code Level | `'L'|'M'|'Q'|'H'` | `M` |
35+
| `(nzRefresh)` | callback | `EventEmitter<string>` | - |
3636

3737
## Note
3838

components/qr-code/doc/index.zh-CN.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ import { NzQRCodeModule } from 'ng-zorro-antd/qr-code';
1919

2020
## API
2121

22-
### nz-qrcode
23-
24-
| 参数 | 说明 | 类型 | 默认值 |
25-
| -------------- |--------------|-----------------------------------|-----------|
26-
| `[nzValue]` | 扫描后的地址 | `string` | - |
27-
| `[nzColor]` | 二维码颜色 | `string` | `#000` |
28-
| `[nzBgColor]` | 二维码背景颜色 | `string` | `#FFFFFF` |
29-
| `[nzSize]` | 二维码大小 | `number` | `160` |
30-
| `[nzPadding]` | 二维码填充 | `number \| number[]` | `0` |
31-
| `[nzIcon]` | 二维码中 icon 地址 | `string` | - |
32-
| `[nzIconSize]` | 二维码中 icon 大小 | `number` | `40` |
33-
| `[nzBordered]` | 是否有边框 | `boolean` | `true` |
34-
| `[nzStatus]` | 二维码状态 | `'active'|'expired' |'loading'` | `active` |
35-
| `[nzLevel]` | 二维码容错等级 | `'L'|'M'|'Q'|'H'` | `M` |
36-
| `(nzRefresh)` | 点击"点击刷新"的回调 | `EventEmitter<string>` | - |
22+
### nz-qrcode:standalone
23+
24+
| 参数 | 说明 | 类型 | 默认值 |
25+
| -------------- | -------------------- | --------------------------------- | --------- |
26+
| `[nzValue]` | 扫描后的地址 | `string` | - |
27+
| `[nzColor]` | 二维码颜色 | `string` | `#000` |
28+
| `[nzBgColor]` | 二维码背景颜色 | `string` | `#FFFFFF` |
29+
| `[nzSize]` | 二维码大小 | `number` | `160` |
30+
| `[nzPadding]` | 二维码填充 | `number \| number[]` | `0` |
31+
| `[nzIcon]` | 二维码中 icon 地址 | `string` | - |
32+
| `[nzIconSize]` | 二维码中 icon 大小 | `number` | `40` |
33+
| `[nzBordered]` | 是否有边框 | `boolean` | `true` |
34+
| `[nzStatus]` | 二维码状态 | `'active'|'expired' |'loading'` | `active` |
35+
| `[nzLevel]` | 二维码容错等级 | `'L'|'M'|'Q'|'H'` | `M` |
36+
| `(nzRefresh)` | 点击"点击刷新"的回调 | `EventEmitter<string>` | - |
3737

3838
## 注意
3939

components/qr-code/qrcode.component.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
44
*/
55

6-
import { isPlatformBrowser } from '@angular/common';
6+
import { isPlatformBrowser, NgIf } from '@angular/common';
77
import {
88
AfterViewInit,
99
ChangeDetectionStrategy,
@@ -24,7 +24,10 @@ import {
2424
import { Subject } from 'rxjs';
2525
import { takeUntil } from 'rxjs/operators';
2626

27+
import { NzButtonModule } from 'ng-zorro-antd/button';
2728
import { NzQRCodeI18nInterface, NzI18nService } from 'ng-zorro-antd/i18n';
29+
import { NzIconModule } from 'ng-zorro-antd/icon';
30+
import { NzSpinModule } from 'ng-zorro-antd/spin';
2831

2932
import { drawCanvas, ERROR_LEVEL_MAP, plotQRCodeData } from './qrcode';
3033

@@ -50,7 +53,9 @@ import { drawCanvas, ERROR_LEVEL_MAP, plotQRCodeData } from './qrcode';
5053
host: {
5154
class: 'ant-qrcode',
5255
'[class.ant-qrcode-border]': `nzBordered`
53-
}
56+
},
57+
imports: [NzSpinModule, NgIf, NzButtonModule, NzIconModule],
58+
standalone: true
5459
})
5560
export class NzQRCodeComponent implements OnInit, AfterViewInit, OnChanges, OnDestroy {
5661
@ViewChild('canvas', { static: false }) canvas!: ElementRef<HTMLCanvasElement>;

components/qr-code/qrcode.module.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,12 @@
33
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
44
*/
55

6-
import { CommonModule } from '@angular/common';
76
import { NgModule } from '@angular/core';
87

9-
import { NzButtonModule } from 'ng-zorro-antd/button';
10-
import { NzIconModule } from 'ng-zorro-antd/icon';
11-
import { NzSpinModule } from 'ng-zorro-antd/spin';
12-
138
import { NzQRCodeComponent } from './qrcode.component';
149

1510
@NgModule({
16-
declarations: [NzQRCodeComponent],
17-
exports: [NzQRCodeComponent],
18-
imports: [NzSpinModule, CommonModule, NzButtonModule, NzIconModule]
11+
imports: [NzQRCodeComponent],
12+
exports: [NzQRCodeComponent]
1913
})
2014
export class NzQRCodeModule {}

0 commit comments

Comments
 (0)