Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

图片选择器在编辑场景下的问题 #921

Closed
270686992 opened this issue Jun 21, 2020 · 6 comments · Fixed by #984
Closed

图片选择器在编辑场景下的问题 #921

270686992 opened this issue Jun 21, 2020 · 6 comments · Fixed by #984
Assignees
Labels
Bug 该 Issue 提出了一个 Bug ImagePicker 图片选择器组件 已解决:+1: Issue 已解决

Comments

@270686992
Copy link

LinUI版本(必填):0.8.3

设备(必填):mac

基础库版本(必填):2.11.0

UI问题,请附上截图

重现步骤,必要时请提供代码片段链接

  • 在文档中,图片选择器的默认值是有接收两种形式的,不知道是什么原因,我使用第一种形式 url 数组的形式接收服务器返回的图片路径时出现了以下情况,经过打印是有路径在数组中的,但报了这个错误:
VM1509:1 Uncaught (in promise) thirdScriptError
{"errMsg":"previewImage:fail parameter error: parameter.urls[0] should be String instead of Undefined;"}
Object

截图如下:
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

  • 而当我直接像官方示例那样在这个数组写死一个路径的时候却是可以正常使用的。
  • 接着我试了第二种对象数组的使用方式,可以正常使用,如下图所示:
    在这里插入图片描述

在这里插入图片描述

  • 希望能够指点一下第一种情况为何不能那样使用。。。
@juzi214032 juzi214032 self-assigned this Jun 21, 2020
@juzi214032 juzi214032 added ImagePicker 图片选择器组件 待反馈:mag: Issue 等待反馈中…… labels Jun 21, 2020
@juzi214032
Copy link
Member

是在点开图片进行预览时报错,还是传入属性的时候就会报错呢

@juzi214032
Copy link
Member

可以提供一下你接口返回的数据格式吗

@270686992
Copy link
Author

点开图片时报错,而且没点开时不能预览,下面是返回的数据格式:
在这里插入图片描述

@juzi214032
Copy link
Member

感谢反馈,这是组件的一个bug,我们将在下个版本进行修复

@juzi214032 juzi214032 added Bug 该 Issue 提出了一个 Bug 处理中:construction: Issue 已确认,正在写代码…… and removed 待反馈:mag: Issue 等待反馈中…… labels Jun 21, 2020
juzi214032 added a commit that referenced this issue Jun 23, 2020
当 urls 初始化为空数组,并在后期修改为字符串数组时
组件无法显示出图片,因为默认将空数组识别为对象数组

该 commit 增加数据监听器,每次设置 urls 都将重新判断类型,保证图片正常显示

close #921
juzi214032 added a commit that referenced this issue Jun 23, 2020
当 urls 初始化为空数组,并在后期修改为字符串数组时
组件无法显示出图片,因为默认将空数组识别为对象数组

该 commit 增加数据监听器,每次设置 urls 都将重新判断类型,保证图片正常显示

close #921
@juzi214032 juzi214032 added 已解决:+1: Issue 已解决 and removed 处理中:construction: Issue 已确认,正在写代码…… labels Jun 23, 2020
@juzi214032 juzi214032 added 处理中:construction: Issue 已确认,正在写代码…… and removed 已解决:+1: Issue 已解决 labels Jun 24, 2020
@juzi214032
Copy link
Member

您好,建议暂时先使用对象数组的方式,后期我们将对这个问题进行优化

@juzi214032 juzi214032 reopened this Jun 25, 2020
juzi214032 added a commit that referenced this issue Jul 30, 2020
cells 属性取代 urls 传入对象类型参数
此后 urls 仅负责接收字符串数组,cells 负责接收对象数组

close #921

BREAKING CHANGE: urls 不再接收对象数组
@juzi214032 juzi214032 linked a pull request Jul 30, 2020 that will close this issue
@juzi214032
Copy link
Member

您好,该问题目前已解决。
imagePicker 组件将新增 cells 属性用于接收对象数组,urls 属性将仅用于接收字符串数组。
此特性将在 0.8.6 版本更新,升级后请注意代码兼容性

@juzi214032 juzi214032 added 已解决:+1: Issue 已解决 and removed 处理中:construction: Issue 已确认,正在写代码…… labels Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 该 Issue 提出了一个 Bug ImagePicker 图片选择器组件 已解决:+1: Issue 已解决
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants