【发布时间】:2021-05-02 00:43:23
【问题描述】:
我编写了一个 TypeScript 代码,编译如下:
define("Global/Global", ["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global = (function () {
function Global() {
}
Global.transition_time = 200;
return Global;
}());
exports.Global = Global;
});
现在,在经典的“script.js”中,我正在尝试 console.log() 的“transition_time”值。但它告诉我“未定义全球”。 我在控制台的全局函数中设置了一个断点,但它从未触发过。
编辑:
这是 Global 的 TypeScript 代码:
export class Global {
static transition_time: number = 200;
}
【问题讨论】:
-
现在,如果你也分享创建这个的打字稿代码会更好吗?你在某个地方需要这个模块吗?
-
我添加了小 TS 代码,我尝试使用它:"require(["Global/Global"]);"没有任何结果。
标签: javascript typescript