UNPKG

laya-coreui-es

Version:

laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改

36 lines (35 loc) 1.06 kB
import { UIComponent } from "./UIComponent"; import { Event } from "../events/Event"; export class Box extends UIComponent { set dataSource(value) { this._dataSource = value; for (var name in value) { var comp = this.getChildByName(name); if (comp) comp.dataSource = value[name]; else if (name in this && !(this[name] instanceof Function)) this[name] = value[name]; } } get dataSource() { return super.dataSource; } get bgColor() { return this._bgColor; } set bgColor(value) { this._bgColor = value; if (value) { this._onResize(null); this.on(Event.RESIZE, this, this._onResize); } else { this.graphics.clear(); this.off(Event.RESIZE, this, this._onResize); } } _onResize(e) { this.graphics.clear(); this.graphics.drawRect(0, 0, this.width, this.height, this._bgColor); } }