iview/src/components/icon/icon.vue

34 lines
734 B
Vue
Raw Normal View History

2016-09-09 14:29:19 +08:00
<template>
<i :class="classes" :style="styles"></i>
</template>
<script>
const prefixCls = 'ivu-icon';
export default {
2017-03-01 17:01:22 +08:00
name: 'Icon',
2016-09-09 14:29:19 +08:00
props: {
type: String,
size: [Number, String],
color: String
2016-09-09 14:29:19 +08:00
},
computed: {
classes () {
2016-12-25 22:49:42 +08:00
return `${prefixCls} ${prefixCls}-${this.type}`;
2016-09-09 14:29:19 +08:00
},
styles () {
let style = {};
2016-12-25 22:49:42 +08:00
if (this.size) {
style['font-size'] = `${this.size}px`;
}
2016-12-25 22:49:42 +08:00
if (this.color) {
style.color = this.color;
2016-09-09 14:29:19 +08:00
}
return style;
2016-09-09 14:29:19 +08:00
}
}
2016-12-25 22:49:42 +08:00
};
</script>