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

保证ImgUploadCom 组件不崩溃

上级 4ad74078
......@@ -51,8 +51,10 @@ export default class index extends Component {
};
render() {
let { path, pathName, width, height } = this.props;
/***
* pathName 必须是个字符串 否则容易崩溃
* */
let { path, pathName = '', width, height } = this.props;
const { visible } = this.state;
let isShow = false;
let type;
......@@ -61,7 +63,11 @@ export default class index extends Component {
isShow = true;
} else {
let find = ['.pdf', '.mp3', '.mp4', '.csv'].find(x => {
return pathName.indexOf(x) > -1;
if(pathName && typeof pathName === 'string'){
return pathName && pathName.indexOf(x) > -1;
}else{
return false;
}
});
if (find) {
isShow = true;
......
......@@ -2440,7 +2440,7 @@ ${obj[dataColumn.base52]}
cm = FilePreview ? (
<FilePreview
path={queryFileUrl(obj[dataColumn.base52])}
pathName={obj[dataColumn.base52]}
pathName={typeof obj[dataColumn.base52] !== 'string' ? '' : obj[dataColumn.base52]}
width={json.width}
height={json.height}
/>
......
......@@ -42,7 +42,6 @@ if (!globalThis.CONFIG) {
const queryConfig = (key) => {
const dynamicConfig = typeof globalThis !== 'undefined' ? globalThis.CONFIG : window.CONFIG;
console.log(dynamicConfig,'dynamicConfig');
if (typeof key === 'undefined') return dynamicConfig;
return dynamicConfig[key];
};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论