main.js
import '@/assets/styles/index.scss';
import 'element-plus/dist/index.css';
import ElementPlus from 'element-plus';
import locale from 'element-plus/lib/locale/lang/zh-cn'; //中文
import * as ElIconModules from '@element-plus/icons';
import App from './App.vue';
const app = createApp(App);
app.use(ElementPlus, { locale });
app.mount('#app');
for (let iconName in ElIconModules) {
app.component(iconName, ElIconModules[iconName]);
}
使用的地方:
<el-button icon="Search" size="small">搜索</el-button>
把单独引用时,使用的“:icon”修改为“icon”