lulouis-vant
Version:
Lightweight Mobile UI Components built on Vue
43 lines (41 loc) • 954 B
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import { use } from '../utils';
import Info from '../info';
import _isSrc from '../utils/validate/src';
var _use = use('icon'),
sfc = _use[0];
export default sfc({
props: {
name: String,
size: String,
color: String,
info: [String, Number],
classPrefix: {
type: String,
default: 'van-icon'
}
},
computed: {
isSrc: function isSrc() {
return _isSrc(this.name);
}
},
render: function render(h) {
return h("i", {
"class": [this.classPrefix, this.isSrc ? 'van-icon--image' : this.classPrefix + "-" + this.name],
"style": {
color: this.color,
fontSize: this.size
},
"on": _extends({}, this.$listeners)
}, [this.$slots.default, this.isSrc && h("img", {
"attrs": {
"src": this.name
}
}), h(Info, {
"attrs": {
"info": this.info
}
})]);
}
});