如图所示,我无法在块中访问所需的变量。我不明白为什么。

define("appkit/controllers/me", ["appkit/utils/uploader", "exports"],
    function (__dependency1__, __exports__) {
        "use strict";
        var Uploader = __dependency1__["default"];
        var MeController;
        MeController = Em.ObjectController.extend({
            username: null,
            actions: {
                uploadProfilePic: function ($el) {
                    /*
                     * PROBLEM:
                     *
                     * I dont understand why variable `Uploader` is not accessible over here.
                     * Could some one please explain?
                     *
                     */
                     uploader = new Uploader(); // This line says "ReferenceError: Uploader is not defined".
                }
            }
        });

        __exports__["default"] = MeController;;
    }
);


我究竟做错了什么?

有人可以解释为什么吗?

最佳答案

在我看来,您已声明了变量Uploader,但随后您试图实例化它的实例,就好像它是一个类一样。

关于javascript - 脚本中 undefined variable 错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21183528/

10-11 22:15