angular 父子组件传值 用get set 访问器设置默认值
private _PLACEHOLDER: string; @Input() public set placeholder(v: string) { this._PLACEHOLDER = v; } public get placeholder(): string { if (this._PLACEHOLDER) { return this._PLACEHOLDER; } else { return ''; } }
private _PLACEHOLDER: string; @Input() public set placeholder(v: string) { this._PLACEHOLDER = v; } public get placeholder(): string { if (this._PLACEHOLDER) { return this._PLACEHOLDER; } else { return ''; } }