Open
Description
一、typings 中包含 Type Definitions 文件
1.使用 npm
安装依赖
npm install bcryptjs --save
2.添加 Type Definitions
文件阻止编译器错误
2.1 安装 typings
npm install -g typings
2.2 安装 bcryptjs dt
文件
typings install dt~bcryptjs --save --global
二、 typings 中不包含Type Definitions 文件
在 index.html
文件中引入对应的文件:
<script src="bcrypt.min.js"></script>
在使用的 ts
文件中声明变量:
declare var dcodeIO: any;
export class HomePage {
public bcryptjs: any;
public hash: string;
constructor() {
this.bcryptjs = dcodeIO.bcrypt;
this.hash = this.bcryptjs.hashSync("nraboy", 8);
}
}
Metadata
Metadata
Assignees
Labels
No labels