在实际项目中,列表常常要添加编号列,实现起来也很简单。
1 .列表的columns中添加列表编号列:
{
title: "序号",
dataIndex: "no",
key: "no",
scopedSlots: { customRender: "no" },
}
2. 列表html中加入对应的slot
<span slot="no" slot-scope="{ index }">
{{ index + 1 }}
</span>
以上两步就简单实现了编号列。