jquery - IBM Worklight 6.1 - Uncaught ReferenceError : WLJQ is not defined, WL 未定义

标签 jquery eclipse backbone.js underscore.js ibm-mobilefirst

我使用 Eclipse Juno 中安装的 IBM Worklight Developer Edition 6.1 作为我的 IDE,使用backbonejs 作为我的项目的主要 javascript 框架。

我的index.html

<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
    <script>window.$ = window.jQuery = WLJQ;</script>

    <script data-main="js/main" src="js/libs/require/require.js"></script>
</head>
<body>

</body>
</html>

我的 main.js

require.config({
    paths: {
        jquery: 'libs/jquery/jquery-min',
        underscore: 'libs/underscore/underscore-min',
        backbone: 'libs/backbone/backbone-min',
        templates: '../templates',
        bootstrap: 'bootstrap.min',
        initOptions: 'initOptions',
        biiRibMobile: 'biiRibMobile',
        messages: 'messages'
    },
});
require(['app', ], function(App) {
    App.initialize();
});

我的app.js

// Filename: app.js
define(['jquery', 'underscore', 'backbone', 'router', // Request router.js
'bootstrap', 'initOptions', 'biiRibMobile', 'messages', ], function($, _, Backbone, Router, bootstrap, initOptions, biiRibMobile, messages) {
    var initialize = function() {
            // Pass in our Router module and call it's initialize function
            Router.initialize();
        };
    return {
        initialize: initialize
    };
});

我的 initOptions.js

var wlInitOptions = {

    logger : {enabled: true, level: 'debug', stringify: true, pretty: false,
        tag: {level: false, pkg: true}, whitelist: [], blacklist: []},

    analytics : {
        enabled: false
        //url : ''
    }

};

if (window.addEventListener) {
    window.addEventListener('load', function() { WL.Client.init(wlInitOptions); }, false);
} else if (window.attachEvent) {
    window.attachEvent('onload',  function() { WL.Client.init(wlInitOptions); });
}

提前非常感谢。

最佳答案

@DavidDhuyveter 在评论中给出了很好的答案。我在 Mac 和 Windows PC 上都遇到了这个问题。他的回答解决了我的 Mac 问题。

对于 Windows,临时文件夹应位于/Users/you/AppData/Local/Temp/1/或类似的位置。

编辑 大卫的评论被删除了。这是原文:

If you are on a mac, do the following: Exit eclipse. Open a terminal window and cd $TMPDIR, rm -rf wlBuildResources wlPreview, Restart Eclipse, rebuild your app and you should be good to go –

关于jquery - IBM Worklight 6.1 - Uncaught ReferenceError : WLJQ is not defined, WL 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20606629/

相关文章:

Java:为什么打包成jar文件的代码会阻止外部类访问?

javascript - 分配给单击事件的 ID 在 backbone.js 中不起作用?

javascript - 我如何使用 jQuery 仅对我的 <li> 元素之一进行 .removeClass ('active' )?

jquery - 通过 ID 和 CSS 属性选择元素

javascript - (js/jquery) 在没有 Canvas 的情况下在 FF/Saf/Chrome 中旋转图像或缩放 Canvas 项目

Java:尝试使用外部 .jar 库时 Eclipse 中出现 NoClassDefFoundError

jquery - 如何将 jquery maphilight 居中对齐?

java - Type enum is not generic 错误克隆和引擎

jquery - backbone.js JSON解析错误

javascript - 为什么人们在主干 View 渲染的第一行正式执行 this.$el.html() ?