wetrade-design
Version:
一款多语言支持Vue3的UI框架
64 lines • 1.72 kB
JavaScript
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { createVNode as _createVNode } from "vue";
import { computed, defineComponent } from 'vue';
import { withInstall } from '../_util/type';
import useConfigInject from '../_util/hooks/useConfigInject';
export var iconProps = function iconProps() {
return {
iconClass: {
type: String,
default: ''
},
color: {
type: String,
default: ''
},
class: {
type: String,
default: ''
},
onClick: {
type: Function
},
onMousedown: {
type: Function
}
};
};
var Icon = defineComponent({
compatConfig: {
MODE: 3
},
name: 'WdIcon',
props: iconProps(),
setup: function setup(props) {
var _useConfigInject = useConfigInject('icon', props),
prefixClsRef = _useConfigInject.prefixCls;
var iconName = computed(function () {
return "#".concat(props.iconClass);
});
var color = computed(function () {
return props.color;
});
var classString = computed(function () {
var _ref;
// const prefixCls = prefixClsRef.value;
return _ref = {}, _defineProperty(_ref, props.class, true), _defineProperty(_ref, "wdicon", true), _ref;
});
return function () {
return _createVNode("span", {
"onClick": props.onClick,
"onMousedown": props.onMousedown,
"class": classString.value
}, [_createVNode("svg", {
"class": prefixClsRef.value,
"aria-hidden": "true"
}, [_createVNode("use", {
"href": iconName.value,
"xlink:href": iconName.value,
"fill": color.value
}, null)])]);
};
}
});
export default withInstall(Icon);