From b79b53ea6f7f41b7d9d80c3787365a7c08ce8acc Mon Sep 17 00:00:00 2001 From: 梁灏 Date: Fri, 11 Nov 2016 18:01:20 +0800 Subject: [PATCH] Icon add color prop --- src/components/icon/icon.vue | 17 +++++++++++------ test/routers/slider.vue | 5 +++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/components/icon/icon.vue b/src/components/icon/icon.vue index 62561cb..d79c030 100644 --- a/src/components/icon/icon.vue +++ b/src/components/icon/icon.vue @@ -7,20 +7,25 @@ export default { props: { type: String, - size: [Number, String] + size: [Number, String], + color: String }, computed: { classes () { return `${prefixCls} ${prefixCls}-${this.type}` }, styles () { + let style = {}; + if (!!this.size) { - return { - 'font-size': `${this.size}px` - } - } else { - return {} + style['font-size'] = `${this.size}px`; + } + + if (!!this.color) { + style.color = this.color; } + + return style; } } } diff --git a/test/routers/slider.vue b/test/routers/slider.vue index 6e5d97c..8b05727 100644 --- a/test/routers/slider.vue +++ b/test/routers/slider.vue @@ -7,12 +7,13 @@ +