iview/src/components/icon/icon.vue

32 lines
713 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 {
props: {
type: String,
size: [Number, String],
color: String
2016-09-09 14:29:19 +08:00
},
computed: {
classes () {
return `${prefixCls} ${prefixCls}-${this.type}`
},
styles () {
let style = {};
2016-09-09 14:29:19 +08:00
if (!!this.size) {
style['font-size'] = `${this.size}px`;
}
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
}
}
}
</script>