我尝试直接导入库
import * as hash from '../../../../node_modules/hashids';并尝试了下面的代码
let id = hash.encode(this.studentDocument.student_id_number); console.log(id);但它抛出了这个错误,很遗憾。
_node_modules_hashids__WEBPACK_IMPORTED_MODULE_2__.encode is not a function我甚至试过这个
declare var hash:any;但是它抛出了这个错误
hash is not defined任何建议都将不胜感激!(续)此post的
发布于 2018-09-10 15:48:13
您需要创建一个新的hashids对象实例。
import * as hash from 'hashids';
const hashids = new hash();
const id = hashids.encode(348029348);
console.log(id);https://stackoverflow.com/questions/52252611
复制相似问题