ELEMENT-PLUS的图标库如何使用
ELEMENT-PLUS的图标库可以通过在组件中使用icon标签来引入图标,具体步骤如下:
- 在项目中引入Element-Plus的样式文件:
import 'element-plus/packages/theme-chalk/src/icon.scss';
- 在需要使用图标的组件中,使用icon标签引入图标,例如:
<template>
<el-button>
<icon name="el-icon-edit"></icon> 编辑
</el-button>
</template>
<script>
import { defineComponent } from 'vue';
import { ElButton, ElIcon } from 'element-plus';
export default defineComponent({
components: {
ElButton,
ElIcon,
},
});
</script>
在上面的例子中,我们在el-button按钮中使用了el-icon-edit的图标,通过icon组件来引入该图标。这样就可以使用Element-Plus的图标库了。