seajs.的使用

來源:互聯網
上載者:User

標籤:

頁面的引用
<script>
    var app = {};
    app.debug = false;
    app.controller = ‘echart/echartControl‘;
</script>
 

<#-- 頁尾開始 -->
<#include "/default/admin/commons/footer.ftl">


頁面頁尾footer.ftl引用:
<script src="/resources/assets/libs/seajs/seajs/2.1.1/sea.js?1.5.3"></script> <script src="/resources/assets/libs/seajs/seajs-style/1.0.1/seajs-style.js?1.5.3"></script> <script src="/resources/assets/libs/seajs-global-config.js?1.5.3"></script> <script> seajs.use("/resources/bundles/schoolweb/js/app.js?1.5.3"); </script>
app.js

define(function(require, exports, module) { window.$ = window.jQuery = require(‘jquery‘); require(‘placeholder‘); require(‘bootstrap‘); require(‘common/bootstrap-modal-hack‘); exports.load = function(name) { require.async(‘./controller/‘ + name + ‘.js?‘ + window.app.version, function(controller){ if ($.isFunction(controller.run)) { controller.run(); } }); }; window.app.load = exports.load; if (app.controller) { exports.load(app.controller); } $(document).ajaxError(function(event, jqxhr, settings, exception) { var json = jQuery.parseJSON(jqxhr.responseText); error = json.error; if (!error) { return ; } if (error.name == ‘Unlogin‘) { $(‘.modal.in‘).modal(‘hide‘); $("#login-modal").modal(‘show‘); $.get($(‘#login-modal‘).data(‘url‘), function(html){ $("#login-modal").html(html); }); } }); if ($(‘html‘).hasClass(‘lt-ie8‘)) { var message = ‘<div class="alert alert-warning" style="margin-bottom:0;text-align:center;">‘; message += ‘您的瀏覽器版本太低,不能正常使用本站,請使用‘; message += ‘<a href="http://windows.microsoft.com/zh-CN/internet-explorer/downloads/ie" target="_blank">IE8瀏覽器</a>、‘; message += ‘<a href="http://www.baidu.com/s?wd=%E8%B0%B7%E6%AD%8C%E6%B5%8F%E8%A7%88%E5%99%A8" target="_blank">Google瀏覽器</a><strong>(推薦)</strong>、‘; message += ‘<a href="http://firefox.com.cn/download/" target="_blank">Firefox瀏覽器</a>,訪問本站。‘; message += ‘</div>‘; $(‘body‘).prepend(message); } $( document ).ajaxSend(function(a, b, c) { if (c.type == ‘POST‘) { b.setRequestHeader(‘X-CSRF-Token‘, $(‘meta[name=csrf-token]‘).attr(‘content‘)); } });});

 admin-app.js:用於載入其他的js

define(function(require, exports, module) {    window.$ = window.jQuery = require(‘jquery‘);    require(‘placeholder‘);    require(‘bootstrap‘);    require(‘common/bootstrap-modal-hack‘);    exports.load = function(name) {        require.async(‘./controller/‘ + name + ‘.js?‘ + window.app.version, function(controller){            if ($.isFunction(controller.run)) {                controller.run();            }        });    };        window.app.load = exports.load;    if (app.controller) {        exports.load(app.controller);    }    $( document ).ajaxSend(function(a, b, c) {        if (c.type == ‘POST‘) {            b.setRequestHeader(‘X-CSRF-Token‘, $(‘meta[name=csrf-token]‘).attr(‘content‘));        }    });});

 

seajs.的使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.