优化插件细节

This commit is contained in:
神仙都没用 2024-03-06 15:47:59 +08:00
parent dae7e482d7
commit d783f473f9
4 changed files with 18 additions and 6 deletions

View File

@ -5,8 +5,8 @@ import Crud, { locale, setFocus } from "@cool-vue/crud";
import "@cool-vue/crud/dist/index.css"; import "@cool-vue/crud/dist/index.css";
// 调试、自定义crud // 调试、自定义crud
// import Crud, { locale, setFocus } from "../../../packages/crud/src"; // import Crud, { locale, setFocus } from "/~/crud/src";
// import "../../../packages/crud/src/static/index.scss"; // import "/~/crud/src/static/index.scss";
export default (): Merge<ModuleConfig, CrudOptions> => { export default (): Merge<ModuleConfig, CrudOptions> => {
return { return {

View File

@ -14,6 +14,7 @@ export default (): ModuleConfig => {
} }
], ],
// 组件依赖过大,如不需求请注释以下代码
components: [() => import("./components/monaco.vue")] components: [() => import("./components/monaco.vue")]
}; };
}; };

View File

@ -41,7 +41,7 @@
item-key="uid" item-key="uid"
:disabled="!draggable" :disabled="!draggable"
@end="update" @end="update"
v-if="showFileList" v-if="showList"
> >
<!-- 触发器 --> <!-- 触发器 -->
<template #footer> <template #footer>
@ -120,7 +120,7 @@
<script lang="ts" setup name="cl-upload"> <script lang="ts" setup name="cl-upload">
import { computed, ref, watch, type PropType, nextTick } from "vue"; import { computed, ref, watch, type PropType, nextTick } from "vue";
import { isArray, isNumber } from "lodash-es"; import { isArray, isEmpty, isNumber } from "lodash-es";
import VueDraggable from "vuedraggable"; import VueDraggable from "vuedraggable";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { PictureFilled, UploadFilled } from "@element-plus/icons-vue"; import { PictureFilled, UploadFilled } from "@element-plus/icons-vue";
@ -247,6 +247,15 @@ const headers = computed(() => {
// //
const list = ref<Upload.Item[]>([]); const list = ref<Upload.Item[]>([]);
//
const showList = computed(() => {
if (props.type == "file") {
return !isEmpty(list.value);
} else {
return true;
}
});
// //
const accept = computed(() => { const accept = computed(() => {
return props.accept || (props.type == "file" ? "" : "image/*"); return props.accept || (props.type == "file" ? "" : "image/*");
@ -505,7 +514,9 @@ defineExpose({
} }
&__file-btn { &__file-btn {
margin-bottom: 10px; & + .cl-upload__list {
margin-top: 10px;
}
} }
:deep(.el-upload) { :deep(.el-upload) {

File diff suppressed because one or more lines are too long