为了账号安全,请及时绑定邮箱和手机立即绑定

替换阵列中 1 个位置上的选择图像

替换阵列中 1 个位置上的选择图像

哆啦的时光机 2021-10-14 13:50:47
我有图像数组。 我想通过单击将所选图像移动到数组中的第一个位置$(document).on('click', '.newProductPic', function () {$(".newProductPic").removeClass("selectImage");$(this).addClass("selectImage");var image = $(".selectImage")[0];var fReader = new FileReader();fReader.onloadend = (function (f) {    return function (e) {        var base64ImageString = this.result;        var imageName = f.name;        imagesListContent.push({ base64ImageString, imageName });        addThumbMainImage(base64ImageString, f.name);        currentMainImage = 'newProductPic' + i + '';    };})(image);fReader.readAsDataURL(image);var temp = $(".newProductPic")[0];imagesListContent[0] = imagesListContent[selectMainImageId];imagesListContent[selectMainImageId] = temp;});我遇到了一个错误:未捕获的类型错误:无法在“FileReader”上执行“readAsDataURL”:参数 1 的类型不是“Blob”。我做错了什么,这个问题的解决方案是什么?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 118 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信