13. 开发个人资料功能

771 字约 2 分钟读完980 次阅读更新于 2026/5/3

学生管理上传头像

<el-upload action="http://localhost:9090/files/upload" list-type="picture" :on-success="handleImgUploadSuccess">
  <el-button type="primary">上传头像</el-button>
</el-upload>
const handleImgUploadSuccess = (res) => {
  data.form.avatar = res.data
}

在表格里显示图片

<el-table-column prop="avatar" label="头像">
  <template #default="scope">
    <el-image v-if="scope.row.avatar" :src="scope.row.avatar" :preview-src-list="[scope.row.avatar]" style="width: 40px; height: 40px; border-radius: 5px"></el-image>
  </template>
</el-table-column>

个人资料

Manager 改了点东西
image.png
image.png