cannot be rendered if string is input by number 0 (#4350)

This commit is contained in:
JoneLau
2019-04-30 10:55:20 +08:00
committed by Weiliang Wang
parent 17f37f7c91
commit c45f1a8bf7
2 changed files with 12 additions and 2 deletions
@@ -179,6 +179,7 @@ export class LabelComponent extends UIRenderComponent {
return this._string;
}
set string (value) {
value = value.toString();
if (this._string === value) {
return;
}
@@ -37,12 +37,18 @@
* node.parent = this.node;
*/
import { Component } from '../../../components';
import { ccclass, executionOrder, menu, property } from '../../../core/data/class-decorator';
import { Color } from '../../../core/value-types';
import { LabelComponent } from './label-component';
import { UIComponent } from './ui-component';
export class LabelOutlineComponent extends UIComponent {
@ccclass('cc.LabelOutlineComponent')
@executionOrder(100)
@menu('UI/Render/LabelOutline')
export class LabelOutlineComponent extends Component {
@property
private _color = new Color(255, 255, 255, 255);
@property
private _width = 1;
/**
@@ -53,9 +59,11 @@ export class LabelOutlineComponent extends UIComponent {
* @example
* outline.color = new cc.Color(0.5, 0.3, 0.7, 1.0);;
*/
@property
get color () {
return this._color;
}
set color (value) {
if (this._color === value){
return;
@@ -73,6 +81,7 @@ export class LabelOutlineComponent extends UIComponent {
* @example
* outline.width = 3;
*/
@property
get width () {
return this._width;
}