提交 5714e649 编写于 作者: Q qiang

fix: 解决H5端uni.previewImage接口current参数为空时报错的问题

上级 52670a2e
......@@ -21,9 +21,12 @@ export const previewImage = {
current: {
type: [String, Number],
validator (value, params) {
// 假值都会被转换为数字 0 无需再做判定
const index = Number(value)
params.current = isNaN(index) ? getRealPath(value) : index
if (typeof value === 'number') {
params.current = value > 0 && value < params.urls.length ? value : 0
} else if (typeof value === 'string' && value) {
params.current = getRealPath(value)
}
},
default: 0
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册