<script>
var $ = layui.$
var up = layui.upload;
up.render({
elem: '#open',
multiple: true,
url: '../sc',
auto: false, //绑定了上传按键时要设自动上传为false
choose: function(obj) {
obj.preview(function(index, file, result) {
$('#wdzp img').attr("src", result);
})
},
// choose: function (obj) {
// obj.preview(function (index, file, result) {
//
$('#wdzp img').attr("src", result);
// newfile = new ImageCompressor(file, {
// quality: 0.6,
// maxWidth: 150,
// maxHeight: 200,
// success(result) {
// obj.resetFile(index, result, file.name);
// },
// });
// });
// },
bindAction: '#upload', //绑定上传按皱键
before: function() {
layer.load()
}, //打开上传提示弹层
allDone: function(obj) {
if (obj.aborted) {
$('#upload-cc').removeClass('layui-hide')
} else {
$('#upload-cc').addClass('layui-hide')
}
layer.closeAll()
}, //关闭上传提示弹层
error: function(index, upload) {
$('#upload').click(function() {
upload()
})
} //关上传出错时给重传绑定upload事件
})
</script>
请问老师: 用layui 框架,jquer上传图片时想前端压缩后上传,红色部分想用注释掉的来改但不行,请问怎么改才行