58 lines
1.6 KiB
Vue

<template>
<div class="page-container">
<el-card>
<template #header>
<div class="card-header">
<span>用户管理</span>
<el-button type="primary" @click="handleAdd">新增用户</el-button>
</div>
</template>
<el-table :data="tableData" border>
<el-table-column prop="username" label="用户名" />
<el-table-column prop="realName" label="姓名" />
<el-table-column prop="phone" label="手机号" />
<el-table-column prop="email" label="邮箱" />
<el-table-column prop="status" label="状态">
<template #default="scope">
<el-tag :type="scope.row.status === 1 ? 'success' : 'danger'">
{{ scope.row.status === 1 ? '启用' : '禁用' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template #default>
<el-button type="primary" link>编辑</el-button>
<el-button type="danger" link>删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script setup>
import { ref } from 'vue'
const tableData = ref([
{ username: 'admin', realName: '管理员', phone: '13800138000', email: 'admin@example.com', status: 1 },
{ username: 'zhangsan', realName: '张三', phone: '13800138001', email: 'zhangsan@example.com', status: 1 }
])
const handleAdd = () => {
console.log('新增用户')
}
</script>
<style scoped>
.page-container {
padding: 20px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>