vue3使用element-plus的icon 时,需要全局引入icon,记录一下
1.安装element- plus icons
npm install @element-plus/icons-vue
2.main.js里全局引用
import * as ElIcons from '@element-plus/icons-vue'
// 统一注册Icon图标
for (const iconName in ElIcons) {
app.component(iconName, ElIcons[iconName])
}
3.使用示例
在这里插入代码片
<el-input
type="text"
placeholder="输入用户名"
prefix-icon="User"
v-model="ruleForm.userName"
>
</el-input>