Skip to content

Commit 40b0f8e

Browse files
authored
[故障] 解决tag在color属性非法时报错的问题,关联了@6193
1 parent 051bb3d commit 40b0f8e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/app/demo/pc/tag/basic/demo.component.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@
2323
<jigsaw-tag color="#01c5c2">#01c5c2</jigsaw-tag>
2424
<jigsaw-tag color="#a17660">#a17660</jigsaw-tag>
2525
</p>
26+
<p style="color:#fff; margin-top:24px;">
27+
<jigsaw-tag [color]="null">非法值1</jigsaw-tag>
28+
<jigsaw-tag [color]="112233">非法值2</jigsaw-tag>
29+
<jigsaw-tag [color]="{}">非法值3</jigsaw-tag>
30+
</p>

src/jigsaw/pc-components/tag/tag.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,15 @@ export class JigsawTag extends AbstractJigsawComponent implements OnInit {
113113
* @internal
114114
*/
115115
public get _$realColor(): string {
116+
let color;
116117
if (this.disabled) {
117-
return this.disabledColor || 'preset-gray';
118+
color = this.disabledColor;
118119
} else if (this.select) {
119-
return this.selectedColor || this.color;
120+
color = this.selectedColor || this.color;
120121
} else {
121-
return this.color;
122+
color = this.color;
122123
}
124+
return typeof color == 'string' ? color : 'preset-gray';
123125
}
124126

125127
/**

0 commit comments

Comments
 (0)