@ecoding/components.antd 0.5.7 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -116,7 +116,7 @@ const MultipleImgUpload = (props) => {
116
116
  file.preview = yield getBase64(file.originFileObj);
117
117
  }
118
118
  let url;
119
- if (file.url) {
119
+ if (file === null || file === void 0 ? void 0 : file.url) {
120
120
  url = domain ? file.url.replace(domain, '') : file.url;
121
121
  }
122
122
  setPreviewImage(url || file.preview);
@@ -225,7 +225,7 @@ const MultipleImgUpload = (props) => {
225
225
  });
226
226
  }
227
227
  else {
228
- if (item.url) {
228
+ if (item === null || item === void 0 ? void 0 : item.url) {
229
229
  // 防止重复拼接domain
230
230
  item.url = domain ? item.url.replace(domain, "") : item.url;
231
231
  item.url = domain ? `${domain}${item.url}` : item.url;
@@ -79,9 +79,16 @@ const SingleFileUpload = (props) => {
79
79
  }));
80
80
  }, []);
81
81
  useEffect(() => {
82
- if (typeof props.value === "string") {
83
- const temp = props.domain ? props.value.replace(props.domain, "") : props.value;
84
- setFileUrl(temp);
82
+ let item = props.value;
83
+ if (typeof item === "string" && item) {
84
+ // 防止重复拼接domain
85
+ item = props.domain ? item.replace(props.domain, "") : item;
86
+ setFileUrl(item);
87
+ }
88
+ if (item === null || item === void 0 ? void 0 : item.url) {
89
+ // 防止重复拼接domain
90
+ item.url = props.domain ? item.url.replace(props.domain, "") : item.url;
91
+ setFileUrl(item.url);
85
92
  }
86
93
  }, [props.value]);
87
94
  return (React.createElement(Space.Compact, { block: true },
@@ -171,7 +171,7 @@ const ImgUpload = (props) => {
171
171
  item = props.domain ? item.replace(props.domain, "") : item;
172
172
  setImageUrl(item);
173
173
  }
174
- if (item.url) {
174
+ if (item === null || item === void 0 ? void 0 : item.url) {
175
175
  // 防止重复拼接domain
176
176
  item.url = props.domain ? item.url.replace(props.domain, "") : item.url;
177
177
  setImageUrl(item.url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "author": "cxc",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -47,5 +47,5 @@
47
47
  "antd": "^6.0.0",
48
48
  "axios": "^1.1.2"
49
49
  },
50
- "gitHead": "32035c81dce6abb37d4b60b1216d2c0253622455"
50
+ "gitHead": "986b28ae9c14b15a968c0a442a0e8ac039766f8d"
51
51
  }