Avatar: fix browser compatibility for IE

As IE doesn't support `Array.prototype.includes`, it will throw error: `Object doesn't support property or method 'includes'`
pull/21368/head
Fengyuan Chen 2021-10-08 20:06:25 +08:00 committed by GitHub
parent 492ab00ad7
commit 5cebd18fce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ export default {
type: [Number, String],
validator(val) {
if (typeof val === 'string') {
return ['large', 'medium', 'small'].includes(val);
return ['large', 'medium', 'small'].indexOf(val) >= 0;
}
return typeof val === 'number';
}
@ -16,7 +16,7 @@ export default {
type: String,
default: 'circle',
validator(val) {
return ['circle', 'square'].includes(val);
return ['circle', 'square'].indexOf(val) >= 0;
}
},
icon: String,