yasuo
This commit is contained in:
@@ -54,7 +54,8 @@ const _sfc_main = defineComponent({
|
||||
dragText: null,
|
||||
modelValue: { default: null },
|
||||
auto: { type: Boolean, default: true },
|
||||
sizeOutMsg: null
|
||||
sizeOutMsg: null,
|
||||
quality: null
|
||||
},
|
||||
emits: [
|
||||
"choose",
|
||||
@@ -68,6 +69,24 @@ const _sfc_main = defineComponent({
|
||||
],
|
||||
setup(__props, { emit }) {
|
||||
const props = __props;
|
||||
function imgcomp(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var options = {
|
||||
file,
|
||||
quality: 0.6,
|
||||
mimeType: "image/jpeg",
|
||||
maxWidth: 2e3,
|
||||
maxHeight: 2e3,
|
||||
convertSize: Infinity,
|
||||
loose: true,
|
||||
redressOrientation: true,
|
||||
success: function(result) {
|
||||
resolve(result);
|
||||
}
|
||||
};
|
||||
new ImageCompressor(options);
|
||||
});
|
||||
}
|
||||
const getCutDownResult = () => {
|
||||
if (_cropper) {
|
||||
const canvas = _cropper.getCroppedCanvas();
|
||||
@@ -164,7 +183,7 @@ const _sfc_main = defineComponent({
|
||||
computedCutLayerOption = computed(() => defaultCutLayerOption.value);
|
||||
}
|
||||
const innerCutVisible = ref(false);
|
||||
const localUploadTransaction = (option) => {
|
||||
const localUploadTransaction = async (option) => {
|
||||
const { url, files } = option;
|
||||
let formData = new FormData();
|
||||
if (url.length <= 5) {
|
||||
@@ -174,7 +193,8 @@ const _sfc_main = defineComponent({
|
||||
if (Array.isArray(files) && files.length > 0) {
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
let _file = files[i];
|
||||
formData.append(props.field + "[" + i + "]", _file);
|
||||
let f = await imgcomp(_file);
|
||||
formData.append(props.field + "[" + i + "]", f);
|
||||
}
|
||||
}
|
||||
if (props.data && props.data instanceof Object) {
|
||||
|
||||
Reference in New Issue
Block a user