diff --git a/src/compenents/tree-category/index.tsx b/src/compenents/tree-category/index.tsx index af7f36b..7e4cb67 100644 --- a/src/compenents/tree-category/index.tsx +++ b/src/compenents/tree-category/index.tsx @@ -89,13 +89,16 @@ export const TreeCategory = (props: PropInterface) => { 全部{props.text} - } - /> + {treeData.length > 0 && ( + } + /> + )} ); }; diff --git a/src/compenents/upload-image-button/index.tsx b/src/compenents/upload-image-button/index.tsx index 545a0ab..2eb4a20 100644 --- a/src/compenents/upload-image-button/index.tsx +++ b/src/compenents/upload-image-button/index.tsx @@ -71,8 +71,10 @@ export const UploadImageButton = (props: PropsInterface) => { // 加载图片列表 useEffect(() => { - getImageList(); - }, [category_ids, refresh, page, size]); + if (showModal) { + getImageList(); + } + }, [category_ids, refresh, page, size, showModal]); return ( <> diff --git a/src/pages/course/compenents/create.tsx b/src/pages/course/compenents/create.tsx index 815ffce..2a2db6f 100644 --- a/src/pages/course/compenents/create.tsx +++ b/src/pages/course/compenents/create.tsx @@ -434,6 +434,7 @@ export const CourseCreate: React.FC = ({ style={{ width: 424 }} treeData={categories} placeholder="请选择课程分类" + treeDefaultExpandAll /> = ({ style={{ width: 424 }} treeData={categories} placeholder="请选择课程分类" + treeDefaultExpandAll /> { - } - /> + {treeData.length > 0 && ( + } + /> + )}