提交 e1a98239 编写于 作者: 雪洛's avatar 雪洛

fix(v3): 修复chooseImage传入字符串格式sizeType导致报错的Bug

上级 81b293e1
...@@ -13,7 +13,7 @@ export const chooseImage = { ...@@ -13,7 +13,7 @@ export const chooseImage = {
} }
}, },
'sizeType': { 'sizeType': {
type: Array, type: [Array, String],
required: false, required: false,
default: SIZE_TYPES, default: SIZE_TYPES,
validator (sizeType, params) { validator (sizeType, params) {
...@@ -21,6 +21,10 @@ export const chooseImage = { ...@@ -21,6 +21,10 @@ export const chooseImage = {
const length = sizeType.length const length = sizeType.length
if (!length) { if (!length) {
params.sizeType = SIZE_TYPES params.sizeType = SIZE_TYPES
} else if (typeof sizeType === 'string') {
if (!~SIZE_TYPES.indexOf(sizeType)) {
params.sizeType = SIZE_TYPES
}
} else { } else {
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
if (typeof sizeType[i] !== 'string' || !~SIZE_TYPES.indexOf(sizeType[i])) { if (typeof sizeType[i] !== 'string' || !~SIZE_TYPES.indexOf(sizeType[i])) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册