Commit 95eacae1 authored by 张烨's avatar 张烨

fix: upload回显报错

parent e3d514ba
...@@ -22,6 +22,7 @@ module.exports = { ...@@ -22,6 +22,7 @@ module.exports = {
sourceType: 'module', sourceType: 'module',
ecmaFeatures: { ecmaFeatures: {
jsx: true, jsx: true,
tsx: true,
}, },
}, },
rules: { rules: {
......
...@@ -63,7 +63,8 @@ class PicturesWall extends React.Component<PicturesWallType> { ...@@ -63,7 +63,8 @@ class PicturesWall extends React.Component<PicturesWallType> {
static getDerivedStateFromProps = (props, state) => { static getDerivedStateFromProps = (props, state) => {
const fileList = state.fileList; const fileList = state.fileList;
if(fileList.length === 0 && props.value){ const shouldUpdate = props.value && fileList.every(f => Array.isArray(props.value) ? !props.value.some(v => f.url === v) : f.url !== props.value)
if(fileList.length === 0 && props.value && shouldUpdate){
return { return {
fileList: Array.isArray(props.value) ? props.value.map((v) => ({ fileList: Array.isArray(props.value) ? props.value.map((v) => ({
url: v, url: v,
......
...@@ -253,10 +253,12 @@ export const getDefaultGetWebconfig = ({ ...@@ -253,10 +253,12 @@ export const getDefaultGetWebconfig = ({
], ],
}, },
}; };
Object.keys(config).forEach(k => { if (initialValues) {
if (initialValues[k]) { Object.keys(config).forEach(k => {
config[k].initialValue = initialValues[k]; if (initialValues[k]) {
} config[k].initialValue = initialValues[k];
}); }
});
}
return config; return config;
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment