项目资料汇总: https://shimo.im/docs/5xkGMv6jpgCj783X/read
带你从0搭建一个Springboot+vue前后端分离项目,真的很简单! https://www.bilibili.com/video/BV14y4y1M7Nc
在conmpoents文件夹下创建Header.vue文件
后台管理
{{ user.nickName }}
个人信息
修改密码
退出系统
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
注意要在main.js中导入
遇见问题,自定义页面无法展示,要在view组件中将自定义组件注册才可以在页面之中展示。
解决方案,在router层中将index.js页面中将默认路径修改为header组件后可以展示
也可以在index.js的默认路径中将,展示页面的homeview.vue改为app.vue
https://element-plus.gitee.io/zh-CN/
查看指南 安装element-plus https://element-plus.gitee.io/zh-CN/guide/installation.html
npm install element-plus --save
注意,一定要在项目文件夹下进行安装
修改main.js中的内容
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
const app = createApp(App)
app.use(ElementPlus)
注意这里的use是可以叠加使用的
例如
createApp(App).use(ElementPlus).use(store).use(router).mount('#app')
测试,在页面中添加一个按钮
按钮
效果展示

https://element-plus.gitee.io/zh-CN/component/icon.html
npm install @element-plus/icons-vue
后台管理
张三
个人信息
修改密码
退出系统
发现没有下拉栏的小箭头图标
main.js
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
const app = createApp(App)
app.use(ElementPlus).use(store).use(router).mount('#app')
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
}
注册arrowdown
在使用下拉栏的组件中导入ArrowDown,否则显示不了下拉箭头
图标自己添加
compoent组件中添加Aside.vue
导航一
选项一
选项二
选项三
选项四
选项一
导航二
导航三
导航四
在app.vue中引入
效果展示

修改app.vue
在el-menu标签中设置样式,添加一个style
Aside.vue文件修改部分如下
导航栏分组管理不是必要的
修改Aside.vue为如下
导航一
选项四
选项一
导航二
导航三
导航四
链接
https://element-plus.gitee.io/zh-CN/component/menu.html
在el-menu标签中设置样式,添加一个style
Aside.vue文件修改部分如下
发现长度过高,没有减去头部的高度
在home.vue中添加
记录产生的问题
有点疑惑了,路由里设置访问的是app.vue,
如果主体设置的在home.vue中,那么要怎样访问到主题呢?
难道是直接设置作为组件么,那view层和component层有什么区别呢?
链接
https://element-plus.gitee.io/zh-CN/component/table.html#基础表格
必须添加在app.vue中才能显示
如果只在home中添加的话,是不显示添加的列表组件的
找到原因了,没有在index.js中注册
router层里index.js
要非常注意import语句,没有用import导入的话是无法注册路由的
import { createRouter, createWebHistory } from 'vue-router'
import Home from "../views/Home"
const routes = [
{
path: '/',
name: 'home',
component: Home
}
]
/.
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
})
export default router
网页链接
https://element-plus.gitee.io/zh-CN/guide/i18n.html
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
app.use(ElementPlus, {
locale: zhCn,
})
添加排序
添加斑马纹
添加搜索
新增
导入
导出
查询
查看
编辑
要在method里面定义函数方法
用@click为按钮绑定函数事件
添加删除确认
https://element-plus.gitee.io/zh-CN/component/popconfirm.html
使用气泡确认框实现
https://element-plus.gitee.io/zh-CN/component/pagination.html
添加函数
},
methods:{
handleEdit(){
},
handleSizeChange(){
},
handleCurrentChange(){
}
}
