From 5cebd18fce35e837764cb315612359f23dda7c98 Mon Sep 17 00:00:00 2001 From: Fengyuan Chen Date: Fri, 8 Oct 2021 20:06:25 +0800 Subject: [PATCH] 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'` --- packages/avatar/src/main.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/avatar/src/main.vue b/packages/avatar/src/main.vue index 3c306287b..b5a24be9d 100644 --- a/packages/avatar/src/main.vue +++ b/packages/avatar/src/main.vue @@ -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,