首先创建个组件
//components/Icon/index.js
import * as Icons from '@ant-design/icons-vue'
import { createVNode } from 'vue'
const Icon = function (props) {
const { type } = props
return createVNode(Icons[type])
};
export { Icon }
组件使用
import { Icon } from '../../components/Icon'
...
components: {
Icon,
...
<icon type="PlusOutlined" />
<icon :type="{item.icon}" />
0 Comments
Leave a comment