3

我正在尝试编写进度条或向我的 Smart Gwt 应用程序添加加载 gif,该应用程序从 onModuleLoad 开始,并在应用程序即将显示时结束。是否有某种类型的事件处理程序可以确定这一点?我已经看过了,但我什么也没找到。

4

1 回答 1

2

注意到在搜索其他内容时没有人回答这个问题。如果您查看 SmartGWT 展示,它们会在应用程序加载时显示一个弹出窗口。在我的应用程序中,我采用了那里的机制,您只需将其添加到您的 webapp.html 中:

作为一部分<head>

<!--CSS for loading message at application Startup-->
<style type="text/css">
    body { overflow:hidden }
    #loading {
        border: 1px solid #ccc;
        position: absolute;
        left: 45%;
        top: 40%;
        padding: 2px;
        z-index: 20001;
        height: auto;
    }

    #loading a {
        color: #225588;
    }

    #loading .loadingIndicator {
        background: white;
        font: bold 13px tahoma, arial, helvetica;
        padding: 10px;
        margin: 0;
        height: auto;
        color: #444;
    }

    #loadingMsg {
        font: normal 10px arial, tahoma, sans-serif;
    }
</style>

作为<body>加载 WebApp.nocache.js 的脚本标记之前的一部分:

<!--add loading indicator while the app is being loaded-->
<div id="loadingWrapper">
<div id="loading">
<div class="loadingIndicator">
    <!--<img src="images/pieces/48/cube_green.gif" width="32" height="32" style="margin-right:8px;float:left;vertical-align:top;"/>SmartGWT<br/>-->
    <img src="WebApp/sc/skins/EnterpriseBlue/images/loading.gif" width="16" height="16" style="margin-right:8px;float:left;vertical-align:top;"/>WebApp<br/>
    <span id="loadingMsg">Loading styles and images...</span></div>
    </div>
</div>

<!--load skin-->
<script type="text/javascript">document.getElementById('loadingMsg').innerHTML = 'Loading skin...';</script>

<script type="text/javascript">
document.write("<"+"script src=WebApp/sc/skins/EnterpriseBlue/load_skin.js isc_version=7.1.js><"+"/script>");
</script>

<script type="text/javascript">document.getElementById('loadingMsg').innerHTML = 'Loading Application<br>Please wait...';</script>
<!--include the application JS-->
于 2011-05-13T19:32:33.607 回答