添加图标icon

https://element-plus.org/zh-CN/component/icon.html
添加图标,将所有图标引入,并以el-icon-arrow的格式使用组件图标

  1. import * as ElementPlusIconsVue from '@element-plus/icons-vue'
  2. const app = createApp(App);
  3. const toLine = (value)=>{
  4. return value.replace(/(A-Z)g/, '-$1').toLowerCase()
  5. }
  6. for ([name, comp] of Object.entries(ElementPlusIconsVue)) {
  7. app.component(`el-icon-${toLine(name)}`, comp);
  8. }
  9. app.use(ElementPlus);