Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Uint8ClampedArray.from不是函数_Javascript - Fatal编程技术网

Javascript Uint8ClampedArray.from不是函数

Javascript Uint8ClampedArray.from不是函数,javascript,Javascript,我发现旧浏览器中的二维码库(JSQR)有问题。当我开始扫描它时,会发出这样的错误消息 "Uint8ClampedArray.from is not a function" source: file:///android_asset/www/js/libs/jsQR.js (143) 在这个文件的第143行有如下代码: this.zero = new GenericGFPoly_1.default(this, Uint8ClampedArray.from([0])); this.one =

我发现旧浏览器中的二维码库(JSQR)有问题。当我开始扫描它时,会发出这样的错误消息

"Uint8ClampedArray.from is not a function"  
 source: file:///android_asset/www/js/libs/jsQR.js (143)
在这个文件的第143行有如下代码:

this.zero = new GenericGFPoly_1.default(this, Uint8ClampedArray.from([0]));
this.one = new GenericGFPoly_1.default(this, Uint8ClampedArray.from([1]));
有人知道如何修复或使用这条线的替代方法吗?它指向哪里。以下是源代码:

您可以替换对
新Uint8ClampedArray([0])
新Uint8ClampedArray([1])的调用。如果有更好的浏览器支持,这将完全相同

const a1=Uint8ClampedArray.from([0]);
常数a2=新的Uint8ClampedArray([0]);
控制台日志(a1);
控制台日志(a2);
常数b1=Uint8ClampedArray.from([1]);
常数b2=新的Uint8ClampedArray([1]);
控制台日志(b1);

控制台日志(b2)浏览器不知道此功能。检查。或者试试别的。例如:

this.zero = new GenericGFPoly_1.default(this, new Uint8ClampedArray([0]));
        this.one = new GenericGFPoly_1.default(this, new Uint8ClampedArray([1]));