Ver código fonte

多张图片预览

wkw 1 semana atrás
pai
commit
efc4756afc
1 arquivos alterados com 11 adições e 2 exclusões
  1. 11 2
      src/views/im/chat/index.vue

+ 11 - 2
src/views/im/chat/index.vue

@@ -268,10 +268,19 @@ const toggleAppBox = async (type) => {
 
 // 预览图片
 const previewImage = (item) => {
-  const url = item?.localUrl || IM_PATH + item.url;
-  showImagePreview([url]);
+  const imageList = wsStore.messages
+    .filter(m => m.contentType === MSG_TYPE.IMAGE)
+    .map(m => m.localUrl || IM_PATH + m.url);
+
+  const index = imageList.findIndex(url => url === (item.localUrl || IM_PATH + item.url));
+
+  showImagePreview({
+    images: imageList,
+    startPosition: index
+  });
 };
 
+
 const onFocus = () => {
   // 隐藏所有面板
   showEmoji.value = false;