/**
 * @author xiufu.wang
 */
import { getIconComponentByName } from 'mars-pro/icons/src/index-light'
export default {
    name: 'ProIcon',
    componentName: 'ProIcon',
    props: {
        icon: String
    },
    computed: {
        isSvgIcon() {
            return this.icon ? getIconComponentByName(this.icon) : false
        }
    },
    render(h) {
        if (!this.icon) {
            return
        }
        if (this.isSvgIcon) {
            return h(this.icon, {
                'class': {
                    'el-icon-svg-cus': true
                },
            }, null)
        } else {
            const _datas = {
                'class': {
                    [this.icon]: true
                }
            }
            return <i {..._datas}></i>
        }
    }
}