目录
1、icon渲染
先引入element plus
<el-icon>
<component :is="item.icon" />
</el-icon>
<script setup>
const taskNum = reactive([
{ title: '今日未下达数', fixed: 2, icon: "Tickets" },
{ title: '今日未完成数', fixed: 26, icon: "Warning" },
{ title: '今日已完成数', fixed: 187, icon: "DocumentChecked" },
{ title: '今日超时未完成数', fixed: 2, icon: "Timer" },
{ title: '今日超时已完成数', fixed: 2, icon: "PieChart" },
{ title: '今日取消总数数', fixed: 189, icon: "CircleClose" }
])
<script>
2、图标和文字无法对齐
设置position为relative,然后通过top调整
<div class="taskZh-title">
<el-icon size="25" style="position:relative;top:7px;margin: 0 5px 0 10px" >
<component :is="item.icon" />
</el-icon>
<span>{{item.title}}</span>
</div>