1. 程式人生 > 實用技巧 >element-table 無資料的時候,把“暫無資料” 改成其他文字或圖片

element-table 無資料的時候,把“暫無資料” 改成其他文字或圖片

1、如下圖:

改成:

在el-table 裡面插入

<template slot="empty">
  <span style="color: #969799;">No more data</span>
</template>
即可
<el-table
                :data="tableData"
                style="width: 100%"
                :header-cell-style="{background:'#F0F2F5',color:'#585858',textAlign: 'center'}"
                >
                <template slot="empty">
                    <span style="color: #969799;">No more data</span>
                </template>
<el-table-column prop="content" label="OrderId" min-width="100" show-overflow-tooltip> </el-table-column> <el-table-column prop="amount" label="amount" min-width="80" show-overflow-tooltip> </el-table-column> <el-table-column prop="type" label="type" min-width="110" show-overflow-tooltip> <template slot-scope="scope"> <span v-if="scope.row.type == 1">Recharge</span> <span v-if="scope.row.type == 2">Withdrawal</span> <span v-if="scope.row.type == 3">consumption</span> <span v-if="scope.row.type == 4">bonus</span> </template> </el-table-column> <el-table-column prop="create_date" min-width="160" show-overflow-tooltip label="Creation time"> <template slot-scope="scope"> {{scope.row.create_date | formatDate}} </template> </el-table-column> </el-table>