格式化

This commit is contained in:
theluyuan 2024-10-22 09:10:04 +08:00
parent 3a9b2d55c6
commit c7194eb604

View File

@ -187,7 +187,7 @@ const props = withDefaults(defineProps<UploadProps>(), {
cut: false, cut: false,
cutOptions: void 0, cutOptions: void 0,
modelValue: null, modelValue: null,
auto: true auto: true,
}); });
const slot = useSlots(); const slot = useSlots();
@ -294,7 +294,7 @@ const errorF = (errorText: string) => {
let errorMsg = errorText ? errorText : defaultErrorMsg; let errorMsg = errorText ? errorText : defaultErrorMsg;
errorMsg = `${errorMsg}`; errorMsg = `${errorMsg}`;
console.warn(errorMsg); console.warn(errorMsg);
layer.msg(errorMsg, { icon: 2, time: 1000 }, function (res: unknown) { }); layer.msg(errorMsg, { icon: 2, time: 1000 }, function (res: unknown) {});
emit("error", Object.assign({ currentTimeStamp, msg: errorMsg })); emit("error", Object.assign({ currentTimeStamp, msg: errorMsg }));
}; };
@ -471,9 +471,22 @@ onUnmounted(() => {
</script> </script>
<template> <template>
<div class="layui-upload layui-upload-wrap" :class="disabledPreview ? 'layui-upload-file-disabled' : ''"> <div
<input type="file" class="layui-upload-file" ref="orgFileInput" :name="field" :field="field" :multiple="multiple" class="layui-upload layui-upload-wrap"
:accept="acceptMime" :disabled="disabled" @click="clickOrgInput" @change="uploadChange" /> :class="disabledPreview ? 'layui-upload-file-disabled' : ''"
>
<input
type="file"
class="layui-upload-file"
ref="orgFileInput"
:name="field"
:field="field"
:multiple="multiple"
:accept="acceptMime"
:disabled="disabled"
@click="clickOrgInput"
@change="uploadChange"
/>
<div v-if="!drag"> <div v-if="!drag">
<div class="layui-upload-btn-box" @click.stop="chooseFile"> <div class="layui-upload-btn-box" @click.stop="chooseFile">
<template v-if="slot.default"> <template v-if="slot.default">
@ -486,12 +499,19 @@ onUnmounted(() => {
</template> </template>
</div> </div>
</div> </div>
<div v-else ref="dragRef" class="layui-upload-drag" :class="disabled <div
? 'layui-upload-drag-disable' v-else
: isDragEnter ref="dragRef"
? 'layui-upload-drag-draging' class="layui-upload-drag"
: '' :class="
" @click.stop="chooseFile"> disabled
? 'layui-upload-drag-disable'
: isDragEnter
? 'layui-upload-drag-draging'
: ''
"
@click.stop="chooseFile"
>
<i class="layui-icon"></i> <i class="layui-icon"></i>
<p>{{ dragText }}</p> <p>{{ dragText }}</p>
<div class="layui-hide" id="uploadDemoView"> <div class="layui-hide" id="uploadDemoView">
@ -499,17 +519,38 @@ onUnmounted(() => {
<img src="" alt="上传成功后渲染" style="max-width: 196px" /> <img src="" alt="上传成功后渲染" style="max-width: 196px" />
</div> </div>
</div> </div>
<lay-layer v-model="innerCutVisible" :title="computedCutLayerOption.title" :move="computedCutLayerOption.move" <lay-layer
:resize="computedCutLayerOption.resize" :shade="computedCutLayerOption.shade" v-model="innerCutVisible"
:shadeClose="computedCutLayerOption.shadeClose" :shadeOpacity="computedCutLayerOption.shadeOpacity" :title="computedCutLayerOption.title"
:zIndex="computedCutLayerOption.zIndex" :btnAlign="computedCutLayerOption.btnAlign" :move="computedCutLayerOption.move"
:area="computedCutLayerOption.area" :anim="computedCutLayerOption.anim" :resize="computedCutLayerOption.resize"
:isOutAnim="computedCutLayerOption.isOutAnim" :btn="computedCutLayerOption.btn" @close="clearAllCutEffect"> :shade="computedCutLayerOption.shade"
<div class="copper-container" v-for="(base64str, index) in activeUploadFilesImgs" :key="`file${index}`"> :shadeClose="computedCutLayerOption.shadeClose"
<img :src="base64str" :id="`_lay_upload_img${index}`" class="_lay_upload_img" /> :shadeOpacity="computedCutLayerOption.shadeOpacity"
:zIndex="computedCutLayerOption.zIndex"
:btnAlign="computedCutLayerOption.btnAlign"
:area="computedCutLayerOption.area"
:anim="computedCutLayerOption.anim"
:isOutAnim="computedCutLayerOption.isOutAnim"
:btn="computedCutLayerOption.btn"
@close="clearAllCutEffect"
>
<div
class="copper-container"
v-for="(base64str, index) in activeUploadFilesImgs"
:key="`file${index}`"
>
<img
:src="base64str"
:id="`_lay_upload_img${index}`"
class="_lay_upload_img"
/>
</div> </div>
</lay-layer> </lay-layer>
<div class="layui-upload-list" :class="disabledPreview ? 'layui-upload-list-disabled' : ''"> <div
class="layui-upload-list"
:class="disabledPreview ? 'layui-upload-list-disabled' : ''"
>
<slot name="preview"></slot> <slot name="preview"></slot>
</div> </div>
</div> </div>