表格loading状态(适用于任何标签的加载中状态)指令:v-loading:详见element ui官网的组件 loading加载
表格自定义空状态
<template slot="empty"><template>
<el-table
v-loading="loading"
:data="tableData"
style="width: 100%">
<el-table-column
prop="date"
label="日期"
width="180">
</el-table-column>
<el-table-column
prop="name"
label="姓名"
width="180">
</el-table-column>
<el-table-column
prop="address"
label="地址">
</el-table-column>
<template slot="empty">
<img src="../assets/images/no_ns_list1.png" alt="" width="110" height="110" style="margin-top:60px;"/>
<span class="no_data_title">暂无相关内容</span>
</template>
</el-table>
script:
export default {
inject:['reload'],
data () {
return {
loading
}
},
methods: {
getDetailData (id) {
this.loading = true
this.$http({
method: "POST",
url: "xxx",
params: {
xxx
}
}).then(res => {
if (res.data.code === 0) {
this.loading = false
}else{
this.$message({
showClose: true,
message: res.data.msg,
duration: 0,
type: 'error'
})
}
}).catch(error => console.log(error));
},
}
}