在组件中element-plusicon。有一个比较大的变化就是所有的图标都以组件的形式呈现。这样的话,我们在使用的时候就需要一一注册了。虽然节省了性能,但是在实际应用中会带来很多麻烦。所以为了方便我选择牺牲这个性能1:安装“@element-plus/icons”,注意element-plus的图标库需要单独安装npminstall@element-plus/icons2:入口文件中(main.ts)引用并注册import{createApp}from'vue'importAppfrom'./App.vue'importElementPlusfrom'element-plus'import'element-plus/dist/index.css'//引入所有图标import*asIconsfrom'@element-plus/icons'constapp=createApp(App)//循环注册所有图标for(constnameinIcons){//name是图标名和组件名。使用时:,//您还可以根据需要添加前缀或后缀//例如:app.component(`eurake-name-${name}`,(Iconsasany)[name])//使用时://当然你也可以写一个方法把图标名字首字母大写改成小写等任何你想要的格式app.component(name,(Iconsasany)[name])}//app.use(ElementPlus).mount('#app')3:使用在组件中4:样式可以设置为全局样式,默认宽高为1em*1em;颜色可以用fillsvg{width:1em;height:1em;fill:#ddd;//color}