mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 09:50:58 +08:00
fce6acb5ca
* feat: update table css * feat: update table css * feat: update table css * feat: update table css
81 lines
2.0 KiB
Vue
81 lines
2.0 KiB
Vue
<template>
|
|
<el-table :data="tableData" style="width: 100%">
|
|
<el-table-column label="Date" width="180">
|
|
<template #default="scope">
|
|
<div style="display: flex; align-items: center">
|
|
<el-icon><timer /></el-icon>
|
|
<span style="margin-left: 10px">{{ scope.row.date }}</span>
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="Name" width="180">
|
|
<template #default="scope">
|
|
<el-popover effect="light" trigger="hover" placement="top">
|
|
<template #default>
|
|
<p>name: {{ scope.row.name }}</p>
|
|
<p>address: {{ scope.row.address }}</p>
|
|
</template>
|
|
<template #reference>
|
|
<div class="name-wrapper">
|
|
<el-tag>{{ scope.row.name }}</el-tag>
|
|
</div>
|
|
</template>
|
|
</el-popover>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="Operations">
|
|
<template #default="scope">
|
|
<el-button size="small" @click="handleEdit(scope.$index, scope.row)"
|
|
>Edit</el-button
|
|
>
|
|
<el-button
|
|
size="small"
|
|
type="danger"
|
|
@click="handleDelete(scope.$index, scope.row)"
|
|
>Delete</el-button
|
|
>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { Timer } from '@element-plus/icons-vue'
|
|
|
|
interface User {
|
|
date: string
|
|
name: string
|
|
address: string
|
|
}
|
|
|
|
const handleEdit = (index: number, row: User) => {
|
|
console.log(index, row)
|
|
}
|
|
const handleDelete = (index: number, row: User) => {
|
|
console.log(index, row)
|
|
}
|
|
|
|
const tableData: User[] = [
|
|
{
|
|
date: '2016-05-03',
|
|
name: 'Tom',
|
|
address: 'No. 189, Grove St, Los Angeles',
|
|
},
|
|
{
|
|
date: '2016-05-02',
|
|
name: 'Tom',
|
|
address: 'No. 189, Grove St, Los Angeles',
|
|
},
|
|
{
|
|
date: '2016-05-04',
|
|
name: 'Tom',
|
|
address: 'No. 189, Grove St, Los Angeles',
|
|
},
|
|
{
|
|
date: '2016-05-01',
|
|
name: 'Tom',
|
|
address: 'No. 189, Grove St, Los Angeles',
|
|
},
|
|
]
|
|
</script>
|