前端生成md5指纹
作者:互联网
需注意this指向变化问题
import SparkMD5 from 'spark-md5'
handleChangePackage (file, fileList) { this.packageList = [] this.packageList = fileList const _this = this const fileReader = new FileReader() const dataFile = file.raw const spark = new SparkMD5.ArrayBuffer() fileReader.readAsArrayBuffer(dataFile) fileReader.onload = function (e) { spark.append(e.target.result) const md5 = spark.end() _this.softwareForm.md5 = md5 } },
标签:const,fileReader,前端,指纹,fileList,file,spark,md5 来源: https://www.cnblogs.com/cyan-l/p/16170208.html