我安装了moment.js库,当遇到此错误时,我将对其进行一些操作。我尝试了许多不同的方法,但是没有任何效果。有什么想法吗?
我有一个文件夹,我已经将moment.js安装到(npm安装时刻),并且正在运行我的程序(节点isDate.js)。
let data = webcamImage.imageAsBase64;
const raw = window.atob(data);
let contentType = raw.split(';')[0];
const rawLength = raw.length;
const unit8array = new Uint8Array(new ArrayBuffer(rawLength));
for (let i = 0; i < rawLength; i++) {
unit8array[i] = raw.charCodeAt(i);
}
let blob = new Blob([unit8array], {type: contentType});
imageProcess.compress(blob, 0.4);
ReferenceError:未定义时刻
答案 0 :(得分:5)
根据Aleks的评论
const moment= require('moment')
为我工作。
答案 1 :(得分:1)
您可以使用它来导入时刻。
import * as moment from 'moment';
答案 2 :(得分:0)
更改此
import {moment} from 'moment';
对此
import moment from 'moment';