提交 2d943a1b authored 作者: 钟是志's avatar 钟是志

优化代码

上级 b0989f58
...@@ -6,7 +6,17 @@ import { Base16Encode } from '@/webPublic/one_stop_public/Base16'; ...@@ -6,7 +6,17 @@ import { Base16Encode } from '@/webPublic/one_stop_public/Base16';
export function FormListButtons(props) { export function FormListButtons(props) {
const [ConcatButtons, setConCatButtons] = useState([]); const [ConcatButtons, setConCatButtons] = useState([]);
const { btns, loading, importConfig, getPage, objId, query, custom, sql, exportConfig } = props; const {
btns,
loading,
importConfig,
getPage,
objId,
query,
custom,
sql,
exportConfig
} = props;
const Before = btns && btns.before || []; const Before = btns && btns.before || [];
useEffect(() => { useEffect(() => {
let buttons = []; let buttons = [];
...@@ -20,7 +30,7 @@ export function FormListButtons(props) { ...@@ -20,7 +30,7 @@ export function FormListButtons(props) {
ButtonType: 'import', ButtonType: 'import',
}); });
} }
let i = 0 ; let i = 0;
for (let item of exportConfig) { for (let item of exportConfig) {
buttons.push({ buttons.push({
...item, ...item,
...@@ -41,7 +51,12 @@ export function FormListButtons(props) { ...@@ -41,7 +51,12 @@ export function FormListButtons(props) {
return ConcatButtons.map((r, i) => { return ConcatButtons.map((r, i) => {
if (r.ButtonType === 'Normal') { if (r.ButtonType === 'Normal') {
return <Button {...r} loading={loading} key={r.children} />; const propsR = { ...r };
delete propsR.ButtonType;
return <Button {...propsR}
loading={loading}
key={r.children}
/>;
} else if (r.ButtonType === 'import') { } else if (r.ButtonType === 'import') {
return (<ImportUtil return (<ImportUtil
btn={r.btn} btn={r.btn}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论