Blogger Information
Blog 42
fans 0
comment 0
visits 15631
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0906element 安装、后台管理系统页搭建、添加和修改表单
小言
Original
580 people have browsed it

1、element 安装

使用npm命令安装在vue目录内

  1. npm install element-plus --save
  1. import ElementPlus from "element-plus";
  2. import "element-plus/dist/index.css";
  3. import * as ElementPlusIconsVue from "@element-plus/icons-vue";
  4. const app = createApp(App);
  5. for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  6. app.component(key, component);
  7. }

最后引入一下

  1. use(ElementPlus, { size: "small", zIndex: 3000 }).

2、后台管理系统

首页搭建

列表页搭建添加和修改表单

  1. <!-- 添加按钮 -->
  2. <div class="mb-4">
  3. <el-button type="primary" size="large" @click="add(0)">添加</el-button>
  4. </div>
  5. <el-table :data="tableData.lists" border style="width: 100%" size="default">
  6. <!-- 表格内容 -->
  7. <el-table-column prop="uid" label="ID" />
  8. <el-table-column prop="account" label="帐号" />
  9. <el-table-column prop="name" label="姓名" />
  10. <el-table-column prop="phone" label="手机号" />
  11. <el-table-column prop="status_s" label="状态" />
  12. <el-table-column prop="add_time" label="入职时间" />
  13. <el-table-column prop="last_time" label="最后登录时间" />
  14. <!-- 操作按钮 -->
  15. <el-table-column label="操作">
  16. <!-- default 这个是默认的插槽 -->
  17. <!-- scope 是传值给这个插槽,这个值是什么呢?就是当前这条数据 -->
  18. <!-- 当数据有多条时,放el-table这个标签里,它会自动循环,每次循环都会把当前的循环值给到el-table -->
  19. <template #default="scope">
  20. <!-- @click="handleEdit(scope.$index, scope.row) -->
  21. <el-button size="small" type="primary" @click="add(scope.row)">修改</el-button>
  22. <el-button size="small" type="danger" >删除</el-button>
  23. </template>
  24. </el-table-column>
  25. </el-table>
  26. <!-- 弹窗效果 -->
  27. <el-dialog
  28. v-model="data.is_from"
  29. :title="data.title"
  30. width="30%"
  31. :before-close="handleClose"
  32. >
  33. <!-- 表单 -->
  34. <el-form :model="fromData" label-width="120px" size="large" >
  35. <el-form-item label="帐号">
  36. <el-input v-model="fromData.account" placeholder="请输入帐号"/>
  37. </el-form-item>
  38. <el-form-item label="密码">
  39. <el-input v-model="fromData.password" type="password" show-password placeholder="data.plac"/>
  40. </el-form-item>
  41. <el-form-item label="姓名">
  42. <el-input v-model="fromData.name"/>
  43. </el-form-item>
  44. <el-form-item label="手机号">
  45. <el-input v-model="fromData.phone"/>
  46. </el-form-item>
  47. <el-form-item label="状态">
  48. <el-select v-model="fromData.status" placeholder="请选择状态">
  49. <el-option label="开启" :value="1" />
  50. <el-option label="关闭" :value="0" />
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item label="入职时间">
  54. <el-date-picker
  55. v-model="fromData.add_time"
  56. type="date"
  57. placeholder="时间"
  58. :disabled-date="disabledDate"
  59. :shortcuts="shortcuts"
  60. :size="size"
  61. />
  62. </el-form-item>
  63. <el-button type="primary" size="large" @click="fun()">确定</el-button>
  64. </el-form>
  65. </el-dialog>
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!