赞
踩
● 项目操作界面
● 技术栈
前后端分离开发,前端主体框架 Vue3 + 后端基础框架 Spring-Boot
● 使用 Vue3+Element-Plus 技术
先下载 node.js LTS 并安装:node.js 的 npm,用于管理前端项目包依赖
创建 Vue 项目
vue create springboot_vue
使用 idea 打开 springboot_vue 项目,并配置项目启动
① 直接将 springboot_vue 项目拖到 idea
② 配置 springboot_vue 使用 npm 方式启动
const {
defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
})
module.exports = {
devServer: {
port: 9090 // 启动端口
}
}
<div></div>
<template>
<div>
</div>
</template>
<style>
</style>
<template> <!--去掉 class="home"--> <div> </div> </template> <script> // @ is an alias to /src // import HelloWorld from '@/components/HelloWorld.vue' export default { name: 'HomeView', components: { // HelloWorld } } </script>
<template> <!-- 这里做了一些样式设置--> <div style="height: 50px; line-height: 50px; border-bottom: 1px solid #ccc; display:flex"> <div style="width: 200px; padding-left: 30px; font-weight: bold; color: dodgerblue">后台管理</div> <div style="flex: 1"></div> <div style="width: 100px">下拉框</div> </div> </template> <script> export default { name: "Header" } </script> <style scoped> </style>
<template> <div> <!--引用组件--> <Header/> </div> </template> <style> </style> <script> import Header from "@/components/Header"; export default { name: "layout", components: { Header } } </script>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
import {
createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// 引入css
import css from '@/assets/css/global.css'
createApp(App).use(store).use(router).mount('#app')
import {
createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// 引入css
import css from '@/assets/css/global.css'
// 引入ElementPlus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css' //相关样式
createApp(App).use(store).use(router).use(ElementPlus).mount('#app')
<template> <div> <!--引用组件--> <Header/> <el-button type="success">Success</el-button> </div> </template> <style> </style> <script> import Header from "@/components/Header"; export default { name: "layout", components: { Header } } </script>
<template> <!-- 这里做了一些样式设置--> <div style="height: 50px; line-height: 50px; border-bottom: 1px solid #ccc; display:flex"> <div style="width: 200px; padding-left: 30px; font-weight: bold; color: dodgerblue">后台管理</div> <div style="flex: 1"></div> <div style="width: 100px"> <el-dropdown> <span class="el-dropdown-link"> tom <el-icon class="el-icon--right"> <arrow-down/> </el-icon> </span> <template #dropdown> <el-dropdown-menu> <el-dropdown-item>个人信息</el-dropdown-item> <el-dropdown-item>退出登录</el-dropdown-item> </el-dropdown-menu> </template> </el-dropdown> </div> </div> </template> <script> export default { name: "Header" } </script> <style scoped> </style>
<template> <div> <!--说明:先去掉这两个方法,否则会报错--> <!-- @open="handleOpen"--> <!-- @close="handleClose"--> <el-menu default-active="2" class="el-menu-vertical-demo"> <el-sub-menu index="1"> <template #title> <el-icon> <location/> </el-icon> <span>导航一</span> </template> <el-menu-item-group title="组一"> <el-menu-item index="1-1">选项1</el-menu-item> <el-menu-item index="1-2">选项2</el-menu-item> </el-menu-item-group> <el-menu-item-group title="组二"> <el-menu-item index="1-3">选项3</el-menu-item> </el-menu-item-group> <el-sub-menu index="1-4"> <template #title>选项4</template> <el-menu-item index="1-4-1">选项4-1</el-menu-item> </el-sub-menu> </el-sub-menu> <el-menu-item index="2"> <el-icon> <icon-menu/> </el-icon> <span>导航二</span> </el-menu-item> <el-menu-item index="3" disabled> <el-icon> <document/> </el-icon> <span>导航三</span> </el-menu-item> <el-menu-item index="4"> <el-icon> <setting/> </el-icon> <span>导航四</span> </el-menu-item> </el-menu> </div> </template> <script> export default { name: "Aside" } </script> <style scoped> </style>
<template> <div> <!--引用组件 头部--> <Header/> <!--引入组件 主体--> <div style="display: flex"> <!--引入组件 侧边栏--> <Aside/> <!--内容区域 这个部分的内容是从HomeView.vue这个组件来的--> <router-view style="flex: 1"/> </div> </div> </template> <style> </style> <script> import Header from "@/components/Header"; import Aside from "@/components/Aside"; export default { name: "layout", components: { Header, Aside } } </script>
<template> <!--去掉 class="home"--> <div> <el-button type="primary">Primary</el-button> </div> </template> <script> // @ is an alias to /src // import HelloWorld from '@/components/HelloWorld.vue' export default { name: 'HomeView', components: { // HelloWorld } } </script>
<template> <div> <!--说明:先去掉这两个方法,否则会报错--> <!-- @open="handleOpen"--> <!-- @close="handleClose"--> <el-menu style="width: 200px" default-active="2" class="el-menu-vertical-demo"> <el-sub-menu index="1-4"> <template #title>选项4</template> <el-menu-item index="1-4-1">选项4-1</el-menu-item> </el-sub-menu> <el-menu-item index="2"> <el-icon> <icon-menu/> </el-icon> <span>导航二</span> </el-menu-item> <el-menu-item index="3" disabled> <el-icon> <document/> </el-icon> <span>导航三</span> </el-menu-item> <el-menu-item index="4"> <el-icon> <setting/> </el-icon> <span>导航四</span> </el-menu-item> </el-menu> </div> </template> <script> export default { name: "Aside" } </script> <style scoped> </style>
<template> <div> <el-table :data="tableData" stripe style="width: 100%"> <el-table-column prop="date" label="日期" width="180"/> <el-table-column prop="name" label="姓名" width="180"/> <el-table-column prop="address" label="地址"/> </el-table> </div> </template> <script> // @ is an alias to /src export default { name: 'HomeView', components: { }, data() { //数据池 return { tableData: [] } } } </script>
import { createApp } from 'vue' import App from './App.vue' import router from './router' import store from './store' // 引入css import css from '@/assets/css/global.css' // 引入ElementPlus import ElementPlus from 'element-plus' import 'element-plus/dist/index.css' //相关样式 //引入国际化需要的组件 import zhCn from 'element-plus/es/locale/lang/zh-cn' createApp(App).use(store).use(router).use(ElementPlus, { locale: zhCn,}).mount('#app')
<template> <!--去掉 class="home"--> <div> <el-table :data="tableData" stripe style="width: 100%"> <el-table-column sortable prop="date" label="日期" width="180"/> <el-table-column prop="name" label="姓名" width="180"/> <el-table-column prop="address" label="地址"/> </el-table> </div> </template> <script> // @ is an alias to /src export default { name: 'HomeView', components: { }, data() { //数据池 return { tableData: [{ date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄' }, { date: '2016-05-04', name: '王小虎', address: '上海市普陀区金沙江路 1517 弄' }, { date: '2016-05-01', name: '王小虎', address: '上海市普陀区金沙江路 1519 弄' }, { date: '2016-05-03', name: '王小虎', address: '上海市普陀区金沙江路 1516 弄' }] } } } </script>
<template>
<div>
<!--新增的按钮-->
<div style="margin: 10px 0">
<el-button type="primary">新增</el-button>
<el-button>其他</el-button>
</div>
<!--引入搜索框-->
<div style="margin: 10px 0">
<el-input v-model="search" placeholder="请输入关键字" style="width: 30%"/>
<el-button style="margin-left: 10px" type="primary">新增</el-button>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。