const {ccclass, property} = cc._decorator; /** * 尺寸布满全屏 */ @ccclass export default class FullScene extends cc.Component { onLoad () { let d1 = cc.winSize.height/cc.winSize.width; let d2 = this.node.height/this.node.width; if(d1 > d2){ this.node.scale = cc.winSize.height/this.node.height; }else{ this.node.scale = cc.winSize.width/this.node.width; } } }