Skip to content

Commit

Permalink
fix: 修复element upload 文件校验失败的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed Dec 15, 2022
1 parent 9188319 commit 7ba48fb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/fast-admin/fs-admin-naive-ui
22 changes: 11 additions & 11 deletions packages/fast-extends/src/uploader/components/fs-file-uploader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export default {
setup(props, ctx) {
const ui = uiContext.get();
const { t } = useI18n();
// uploader 的 modelValue
const fileList = ref([]);
const currentValue = ref();
const fileListLocal = ref([]);
Expand Down Expand Up @@ -134,7 +135,6 @@ export default {
return value[props.valueType];
}
function initValue(value) {
console.log("init value", value);
const array = [];
if (value == null || value.length === 0) {
fileList.value = array;
Expand All @@ -151,7 +151,7 @@ export default {
}
initValue(props.modelValue);
fileListLocal.value = fileList.value;
updateLocalFileList(fileList.value);
function onChange(value) {
ctx.emit("change", value);
Expand Down Expand Up @@ -200,7 +200,7 @@ export default {
}
function handleChange(file, list) {
fileListLocal.value = list;
updateLocalFileList(list);
emitValue(list);
}
Expand Down Expand Up @@ -260,8 +260,7 @@ export default {
}
}
const beforeUpload = async (file, list) => {
console.log("before upload", file, fileList);
const beforeUpload = async (file) => {
if (props.beforeUpload) {
const ret = await props.beforeUpload({ file, fileList: fileListLocal.value });
if (ret === false) {
Expand All @@ -270,11 +269,12 @@ export default {
}
checkLimit();
checkSizeLimit(file);
// fileList.value = [...fileList.value, file];
fileListLocal.value = fileList.value;
};
function updateLocalFileList(list) {
fileListLocal.value = list;
}
async function doUpload(option) {
option.options = props.uploader;
let uploaderRef = uploaderImplRef.value.getUploaderRef();
Expand Down Expand Up @@ -483,16 +483,16 @@ export default {
display: none;
}
}
.ant-upload-list-item-actions{
.ant-upload-list-item-actions {
display: flex;
align-items: center;
> a{
> a {
display: flex;
align-items: center;
}
}
.el-upload{
.el-upload {
justify-content: left;
}
// element
Expand Down
8 changes: 3 additions & 5 deletions packages/ui/ui-element/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@
"@fast-crud/ui-interface": "^1.7.1",
"lodash-es": "^4.17.21"
},
"peerDependencies": {
"@element-plus/icons-vue": "^2.0.4",
"@fast-crud/fast-crud": "*",
"element-plus": "^2.2.12"
},
"devDependencies": {
"@element-plus/icons-vue": "^2.*",
"@fast-crud/fast-crud": "^1.*",
"element-plus": "^2.*",
"@rollup/plugin-strip": "^3.0.1",
"@rollup/plugin-typescript": "^10.0.1",
"@types/lodash-es": "^4.17.6",
Expand Down

0 comments on commit 7ba48fb

Please sign in to comment.