element-ui表格数量为空时,给表格中插入图片或其他元素样式
通过插槽可以实现
<template slot="empty">
<div style="margin-top: 35px">
<img src="/static/images/cart-empty.png" />
</div>
</template>
使用案例
<el-table
:data="shoppData"
:header-cell-style="{
'background-color': '#E0E3E9',
color: '#2B3B4E',
padding: '13px 0',
height: '60px',
opacity: '0.5',
}"
row-key="id"
@selection-change="selectionChange"
>
<template slot="empty">
<div style="margin-top: 35px">
<img src="/static/images/cart-empty.png" />
</div>
</template>
<el-table-column
type="selection"
:selectable="selectable"
>
</el-table-column>
...
</el-table>