From dd8559a2aafef92289084be4769d0072e02fb80c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Sun, 29 Dec 2019 08:29:59 +0800 Subject: [PATCH] chore(Icon): improve perf --- src/button/test/__snapshots__/demo.spec.js.snap | 6 ++---- src/icon/index.less | 1 + src/icon/index.tsx | 10 +++++----- src/icon/test/__snapshots__/index.spec.js.snap | 12 ++++-------- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/button/test/__snapshots__/demo.spec.js.snap b/src/button/test/__snapshots__/demo.spec.js.snap index 75ac8ffa7..035fca401 100644 --- a/src/button/test/__snapshots__/demo.spec.js.snap +++ b/src/button/test/__snapshots__/demo.spec.js.snap @@ -18,10 +18,8 @@ exports[`renders demo correctly 1`] = `
+ 按钮
diff --git a/src/icon/index.less b/src/icon/index.less index 71e752afa..f1b78f967 100644 --- a/src/icon/index.less +++ b/src/icon/index.less @@ -5,5 +5,6 @@ &__image { width: 1em; height: 1em; + object-fit: contain; } } diff --git a/src/icon/index.tsx b/src/icon/index.tsx index 5baa1a4c4..833a20bf9 100644 --- a/src/icon/index.tsx +++ b/src/icon/index.tsx @@ -1,7 +1,6 @@ import { createNamespace, addUnit } from '../utils'; import { inherit } from '../utils/functional'; import Info from '../info'; -import Image from '../image'; // Types import { CreateElement, RenderContext } from 'vue/types'; @@ -43,7 +42,10 @@ function Icon( return ( {slots.default && slots.default()} - {imageIcon && ( - - )} + {imageIcon && } ); diff --git a/src/icon/test/__snapshots__/index.spec.js.snap b/src/icon/test/__snapshots__/index.spec.js.snap index a3422ace5..54ddf2e50 100644 --- a/src/icon/test/__snapshots__/index.spec.js.snap +++ b/src/icon/test/__snapshots__/index.spec.js.snap @@ -17,17 +17,13 @@ exports[`render icon with builtin icon name 1`] = ` `; exports[`render icon with local image 1`] = ` - -
- -
+ + `; exports[`render icon with url name 1`] = ` - -
- -
+ + `; exports[`size without unit 1`] = `