豆宝社区项目实战教程简介
本项目实战教程配有免费视频教程,配套代码完全开源。手把手从零开始搭建一个目前应用最广泛的Springboot+Vue前后端分离多用户社区项目。本项目难度适中,为便于大家学习,每一集视频教程对应在Github上的每一次提交。
项目首页截图
代码开源地址
视频教程地址
前端技术栈
Vue
Vuex
Vue Router
Axios
Bulma
Buefy
Element
Vditor
DarkReader
后端技术栈
Spring Boot
Mysql
Mybatis
MyBatis-Plus
Spring Security
JWT
Lombok
前端页面布局
1.在 /src/viwes/Home.vue添加一下代码
<!-- https://bulma.io/documentation/columns/basics 官网 is-three-quarters 是占页面的3/4 --> <div class="columns"> <div class="column is-three-quarters">First column</div> <div class="column">Second column</div> </div>
测试页面
2.创建侧边栏
在 /src/views/card/CardBar.vue
<template> <div> 侧标栏 </div> </template> <script> import { getBillboard } from "@/api/billboard"; export default { name: "CardBar", data() { return { } }, created() { }, methods: { }, }; </script>
3.创建帖子列表
在 /src/views/post/index.vue
<template> <div> 帖子列表 </div> </template> <script> import { getBillboard } from "@/api/billboard"; export default { name: "TopicList", data() { return { } }, created() { }, methods: { }, }; </script>
4.修改Home.vue
5.测试查看页面
6.侧边栏
6.1LoginWelome
在 /src/views/card/LoginWelome.vue
<template> <div> <el-card> <div class="header"> <span>帖子列表</span> </div> <div>boy</div> </el-card> </div> </template> <script> import { getBillboard } from "@/api/billboard"; export default { name: "CardBar", data() { return {}; }, created() {}, methods: {} }; </script>
6.2Promotion
在 /src/views/card/Promotion.vue
<template> <div> <el-card> <div class="header"> <span>帖子列表</span> </div> <div>boy</div> </el-card> </div> </template> <script> import { getBillboard } from "@/api/billboard"; export default { name: "CardBar", data() { return {}; }, created() {}, methods: {} }; </script>
6.3Tip(每日一句)
在 /src/views/card/Tip.vue
<template> <div> <el-card> <div class="header"> <span>每日一句</span> </div> <div class="has-text-left block"> 是个手指哦图 </div> <div class="has-text-right mt-5 block"> -张三 </div> </el-card> </div> </template> <script> import { getBillboard } from "@/api/billboard"; export default { name: "CardBar", data() { return {}; }, created() {}, methods: {} }; </script>
6.4修改views/card/CardBar.vue
<template> <section> <!-- 是否登录 --> <login-welome></login-welome> <!-- 今日赠言 --> <tip></tip> <!-- 资源推荐 --> <promotion></promotion> </section> </template> <script> import LoginWelome from '@/views/card/LoginWelome' import Promotion from '@/views/card/Promotion' import Tip from '@/views/card/Tip' export default { name: "CardBar", components: {LoginWelome,Promotion,Tip}, data() { return {}; }, created() {}, methods: {} }; </script>
6.5查看页面
页面样式
1.assets下创建/app.css
复制一下内容即可
* { margin: 0; padding: 0; } body, html { background-color: #f6f6f6; color: black; width: 100%; font-size: 14px; letter-spacing: 0.03em; font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif, Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji, Segoe UI Symbol, Android Emoji, EmojiSymbols; } .el-card{ margin-bottom: 16px; }
2.在main.js引入
import '@/assets/app.css'
刷新页面看页面效果