请提供一个基于Element UI实现用户的个人中心页面给我
时间: 2023-06-06 09:06:29 浏览: 100
好的,我可以为您提供一个基于Element UI实现的用户个人中心页面示例。以下是代码:
```
<template>
<div class="user-profile">
<el-row justify="center" class="user-profile__header">
<el-col :span="12" class="user-profile__title">个人中心</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-card>
<div slot="header" class="user-profile__card-title">个人资料</div>
<div class="user-profile__avatar-container">
<el-avatar :src="user.avatar" size="150px"></el-avatar>
</div>
<div class="user-profile__info">
<div class="user-profile__info-item">
<span class="user-profile__label">用户名:</span>
<span class="user-profile__text">{{ user.name }}</span>
</div>
<div class="user-profile__info-item">
<span class="user-profile__label">性别:</span>
<span class="user-profile__text">{{ user.gender }}</span>
</div>
<div class="user-profile__info-item">
<span class="user-profile__label">邮箱:</span>
<span class="user-profile__text">{{ user.email }}</span>
</div>
</div>
</el-card>
</el-col>
<el-col :span="8">
<el-card>
<div slot="header" class="user-profile__card-title">账户设置</div>
<div class="user-profile__info">
<div class="user-profile__info-item">
<span class="user-profile__label">手机号:</span>
<span class="user-profile__text">{{ user.phone }}</span>
</div>
<div class="user-profile__info-item">
<span class="user-profile__label">密码:</span>
<span class="user-profile__text">*******</span>
</div>
</div>
<div class="user-profile__actions">
<el-button class="user-profile__action-btn" type="primary">修改密码</el-button>
</div>
</el-card>
</el-col>
<el-col :span="8">
<el-card>
<div slot="header" class="user-profile__card-title">通知</div>
<div class="user-profile__info">
<div class="user-profile__info-item">
<span class="user-profile__label">消息数量:</span>
<span class="user-profile__text">{{ user.notification }}</span>
</div>
<div class="user-profile__info-item">
<span class="user-profile__label">最近一条通知:</span>
<span class="user-profile__text">{{ user.lastNotification }}</span>
</div>
</div>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
export default {
data() {
return {
user: {
name: '张三',
gender: '男',
avatar: 'https://cdn.vuetifyjs.com/images/lists/1.jpg',
email: '123456789@qq.com',
phone: '138****1234',
notification: 5,
lastNotification: '您有一条新消息'
}
}
}
}
</script>
<style>
.user-profile {
margin: 20px;
}
.user-profile__header {
margin-bottom: 30px;
}
.user-profile__title {
font-size: 24px;
}
.user-profile__card-title {
font-size: 20px;
}
.user-profile__avatar-container {
display: flex;
justify-content: center;
margin: 20px;
}
.user-profile__info {
margin: 20px 0;
}
.user-profile__info-item {
display: flex;
margin-bottom: 10px;
}
.user-profile__label {
color: #bbb;
margin-right: 10px;
}
.user-profile__text {
font-weight: bold;
}
.user-profile__actions {
display: flex;
justify-content: center;
}
.user-profile__action-btn {
width: 100%;
}
</style>
```
您可以在以上代码的基础上进行修改和扩展,以满足您的具体需求。
阅读全文