Toastr 信息未出现在我的屏幕上
Toastr info not appearing on my screen
我正在使用打字稿创建一个非常简单的网络应用程序。现在,它要做的就是创建一个矩形并显示该区域的信息提示。不幸的是,吐司永远不会出现。该行代码已执行,并且在 Internet Explorer 或 Google Chrome 的开发工具中没有任何错误或警告。这是我拥有的:
打字稿:
/// <reference path="../typings/toastr/toastr.d.ts" />
interface IRectangle {
height: number;
width: number;
getArea(): number;
}
module Shapes {
export class Rectangle implements IRectangle {
getArea(): number {
return this.height * this.width;
}
constructor(
public height: number,
public width: number) {
}
}
}
var rect: IRectangle = new Shapes.Rectangle(10, 4);
var area = rect.getArea();
toastr.info("area = " + area);
结果javascript如下:
/// <reference path="../typings/toastr/toastr.d.ts" />
var Shapes;
(function (Shapes) {
var Rectangle = (function () {
function Rectangle(height, width) {
this.height = height;
this.width = width;
}
Rectangle.prototype.getArea = function () {
return this.height * this.width;
};
return Rectangle;
})();
Shapes.Rectangle = Rectangle;
})(Shapes || (Shapes = {}));
var rect = new Shapes.Rectangle(10, 4);
var area = rect.getArea();
toastr.info("area = " + area);
//# sourceMappingURL=04-01-internal-module.js.ma
我的HTML只是为了祝酒词。这是我能想象到的最简单的例子,但它仍然不起作用:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="../scripts/jquery-1.6.3.js"></script>
<link href="../content/toastr.css" rel="stylesheet" />
<script src="../scripts/toastr.js"></script>
<script src="../scripts/app/04-02-internal-module.js"></script>
</head>
<body>
</body>
</html>
就像我说的。页面加载正常,但没有任何反应。我知道我应该看到什么,因为我使用了位于此处的演示:http://codeseven.github.io/toastr/demo.html
但是,什么也没有出现。知道我做错了什么吗?
我已经创建了一个 fiddle,它似乎工作正常,我唯一可以建议的是你的文档还没有准备好,所以尝试像这样包装
$(document).ready(function () {
toastr.success("message", 'test');
});
我正在使用打字稿创建一个非常简单的网络应用程序。现在,它要做的就是创建一个矩形并显示该区域的信息提示。不幸的是,吐司永远不会出现。该行代码已执行,并且在 Internet Explorer 或 Google Chrome 的开发工具中没有任何错误或警告。这是我拥有的:
打字稿:
/// <reference path="../typings/toastr/toastr.d.ts" />
interface IRectangle {
height: number;
width: number;
getArea(): number;
}
module Shapes {
export class Rectangle implements IRectangle {
getArea(): number {
return this.height * this.width;
}
constructor(
public height: number,
public width: number) {
}
}
}
var rect: IRectangle = new Shapes.Rectangle(10, 4);
var area = rect.getArea();
toastr.info("area = " + area);
结果javascript如下:
/// <reference path="../typings/toastr/toastr.d.ts" />
var Shapes;
(function (Shapes) {
var Rectangle = (function () {
function Rectangle(height, width) {
this.height = height;
this.width = width;
}
Rectangle.prototype.getArea = function () {
return this.height * this.width;
};
return Rectangle;
})();
Shapes.Rectangle = Rectangle;
})(Shapes || (Shapes = {}));
var rect = new Shapes.Rectangle(10, 4);
var area = rect.getArea();
toastr.info("area = " + area);
//# sourceMappingURL=04-01-internal-module.js.ma
我的HTML只是为了祝酒词。这是我能想象到的最简单的例子,但它仍然不起作用:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="../scripts/jquery-1.6.3.js"></script>
<link href="../content/toastr.css" rel="stylesheet" />
<script src="../scripts/toastr.js"></script>
<script src="../scripts/app/04-02-internal-module.js"></script>
</head>
<body>
</body>
</html>
就像我说的。页面加载正常,但没有任何反应。我知道我应该看到什么,因为我使用了位于此处的演示:http://codeseven.github.io/toastr/demo.html
但是,什么也没有出现。知道我做错了什么吗?
我已经创建了一个 fiddle,它似乎工作正常,我唯一可以建议的是你的文档还没有准备好,所以尝试像这样包装
$(document).ready(function () {
toastr.success("message", 'test');
});