refine: table demo add status
This commit is contained in:
parent
3f4e9cc50f
commit
ee35d1c0a4
|
@ -11,7 +11,6 @@
|
||||||
{{scope.row.title}}
|
{{scope.row.title}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="Author" width="110" align="center">
|
<el-table-column label="Author" width="110" align="center">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
<span>{{scope.row.author}}</span>
|
<span>{{scope.row.author}}</span>
|
||||||
|
@ -22,6 +21,11 @@
|
||||||
{{scope.row.pageviews}}
|
{{scope.row.pageviews}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column class-name="status-col" label="Status" width="110" align="center">
|
||||||
|
<template scope="scope">
|
||||||
|
<el-tag :type="scope.row.status | statusFilter">{{scope.row.status}}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column align="center" prop="created_at" label="Display_time" width="200">
|
<el-table-column align="center" prop="created_at" label="Display_time" width="200">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
<i class="el-icon-time"></i>
|
<i class="el-icon-time"></i>
|
||||||
|
@ -42,6 +46,16 @@ export default {
|
||||||
listLoading: true
|
listLoading: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
filters: {
|
||||||
|
statusFilter(status) {
|
||||||
|
const statusMap = {
|
||||||
|
published: 'success',
|
||||||
|
draft: 'gray',
|
||||||
|
deleted: 'danger'
|
||||||
|
}
|
||||||
|
return statusMap[status]
|
||||||
|
}
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue