直接在浏览器中使用 vue3+element-plus中icons的方法
首先引入文件,如果用cdn的方式:
<script src="//unpkg.com/@element-plus/icons-vue"></script>
我们也可以直接下载下来,是一个index.iife.min.js文件,引入到文件中。
接下来我们需要在底部挂载的地方将所有的图标挂载进来:
for ([name, comp] of Object.entries(ElementPlusIconsVue)) { app.component(name, comp); }
这样我们就可以使用element中的icons了:
<el-icon :size="20"><Clock /></el-icon>