Skip to content

有没有办法做到在windows onload之后再创建舞台? #46

Closed
@alexxxcs1

Description

@alexxxcs1

现在我是用一个 createstage.js 来创建舞台,再index.js中引入 createstage.js

import {Scene} from 'spritejs';

console.log('in frame window height:' + window.innerHeight);
window.onload = function(){
    console.log('out frame window onloaded height:' + window.innerHeight); 
}
const stage = new Scene('#stage', {
    viewport: [750, 1334-110],  
    resolution: [750,1334-110],
    stickMode: '', 
    stickExtend :true,
}
);
const stageprop = {
    width:stage.resolution[0],
    height:stage.resolution[1],
};

export {stage,stageprop}

这样在场景页面我就能通过stageprop拿到场景的宽高,但是这个宽高其实是设计宽高,手机实际宽高window.innerHeight需要在window.onload里面拿的才是真实的,所以我想问有没有解决方法在window.onload之后再创建舞台?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions