af-mobile-client-vue3 1.1.15 → 1.1.16

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.1.15",
4
+ "version": "1.1.16",
5
5
  "description": "Vue + Vite component lib",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -19,12 +19,20 @@ const imageList = ref(props.imageList)
19
19
  // 监听 props.imageList 的变化
20
20
  watch(() => props.imageList, (newVal) => {
21
21
  if (newVal?.length > 0) {
22
- imageList.value = newVal.map((item) => {
22
+ const existingIds = imageList.value ? imageList.value.map(item => item.id) : []
23
+ const newItems = newVal.filter(item => !item.id || !existingIds.includes(item.id)).map((item) => {
23
24
  return { id: item.id, name: item.f_filename, url: item.f_downloadpath }
24
25
  })
26
+ if (newItems.length > 0) {
27
+ if (!imageList.value) {
28
+ imageList.value = newItems
29
+ }
30
+ else {
31
+ imageList.value = [...imageList.value, ...newItems]
32
+ }
33
+ }
25
34
  }
26
35
  }, { immediate: true, deep: true })
27
-
28
36
  // 上传图片
29
37
  function fileUpload(file: any): void {
30
38
  const formData = new FormData()