Skip to content

Commit

Permalink
fix: 修复icon加载问题
Browse files Browse the repository at this point in the history
  • Loading branch information
JackySoft committed Sep 26, 2024
1 parent a0207d4 commit 9f69d72
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/admin/src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ const MenuComponent: React.FC = () => {
const iconsList: { [key: string]: any } = Icons;
if (item.buttons?.length || !item.children) {
const path = `/project/${env}/${projectId}/${item.page_id || 0}`;
return treeList.push(getMenuItem(item.name, path, React.createElement(iconsList[item.icon])));
return treeList.push(getMenuItem(item.name, path, iconsList[item.icon] && React.createElement(iconsList[item.icon])));
}
const path = `/project/${env}/${projectId}/${item.id}`;
treeList.push(getMenuItem(item.name, path, React.createElement(iconsList[item.icon]), getTreeMenu(item.children || [])));
treeList.push(
getMenuItem(item.name, path, iconsList[item.icon] && React.createElement(iconsList[item.icon]), getTreeMenu(item.children || [])),
);
}
});
return treeList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const SearchForm = ({ id, type, config, elements, onSearch, onChange, onReset }:
const iconsList: { [key: string]: any } = icons;
return (
visible && (
<FormContext.Provider value={form}>
<FormContext.Provider value={{ form, formId: id, setFormData }}>
<Form form={form} layout="inline" style={config.style} data-id={id} data-type={type} onValuesChange={handleValuesChange}>
<div className={styles.formWrap} ref={drop} style={!isExpand ? { height: 32, overflow: 'hidden' } : {}}>
{elements.length ? <MarsRender elements={elements} /> : <div className="slots">拖拽表单组件到这里</div>}
Expand Down
2 changes: 1 addition & 1 deletion packages/materials/Scene/SearchForm/SearchForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const SearchForm = ({ id, type, config, elements, onSearch, onChange, onReset }:
const iconsList: { [key: string]: any } = icons;
return (
visible && (
<FormContext.Provider value={form}>
<FormContext.Provider value={{ form, formId: id, setFormData }}>
<Form form={form} layout="inline" style={config.style} onValuesChange={handleValuesChange}>
<div className={styles.formWrap} style={!isExpand ? { height: 32, overflow: 'hidden' } : {}}>
<MarsRender elements={elements} />
Expand Down

0 comments on commit 9f69d72

Please sign in to comment.