vben3的preview组件为什么会请求两次图片地址 #3266
Unanswered
dengdai11201
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
近日在使用preview组件时(采用无预览图方法),imgList中自定义了图片地址,实际中在点击打开预览时,图片会请求两次(甚至关闭预览都会请求一次),而看请求结果常常时第一次成功而第二次失败,然后整个图片就无法展示,请大佬帮忙看看这个问题。

报错内容是rpc error: code = Internal desc = unexpected EOF;
代码如下:
<div>
<Tooltip placement="rightTop" title="图片预览" @click="handlePreview" >
<Icon style="margin-right: 4px" icon="ant-design:chrome-filled" size="24px" class="iconStyle"/>
</Tooltip>
</div>
export default defineComponent({ name: 'imgPreview', components: { Icon, Tooltip, Image }, props: ['taskInfo'], setup(props) { let imgList: string[]=[]; async function handlePreview() { imgList=[ // 'https://picsum.photos/id/66/346/216',
/track/tile/point_img?tile_id=0&tile_branch=${props.taskInfo.tile_branch}&trail_id=0&type=260&task_id=TO${props.taskInfo.id}]; await createImgPreview({ imageList: imgList,defaultWidth:500,maskClosable:true}); } return { handlePreview }; }, });
Beta Was this translation helpful? Give feedback.
All reactions