好的代码一定有好的目录结构,本项目不同于原生vue
目录结构和路由
所有已经开发完毕组件的封装
1.switch-theme
2.desktop-nav(PC端适配)
3.page-header
4.page-footer
5.split-line
6.detail-header
7.article-list
8.tag-detail
9.empty(当没有文章的时候显示)使用pulugin全局挂载(无需引入)
封装http请求参考大牛的封装(使用axios)
已经完成的页面
1.tag标签页(分为标签页和分类页)
2.标签页
3.分类页(未完成)
4.关于我们
5.关于我们某个人(使用_id来开发原生vue没有的功能)
待完成的页面
1.主页(轮播图实现)2.分类 3.留言墙 4.搜索
vuex(状态管理)和models(业务处理)
vuex(已完成部分)!!!!全部关联models
1.app.js(处理switch-theme主题切换使用缓存)
2.about.js 获取作者信息和相关文章和更多文章(LoadMore)
3.获取友链 friend.js
4.tag.js 获取标签和分类和文章列表和更多文章(LoadMore)
models已完成部分
1.tag.js
import {
get
} from '@/services/http/axios'
class Tag {
// 获取所有标签
async getTags() {
const res = await get('v1/blog/tag/tags')
return res
}
}
export default new Tag()
2.category.js
import {
get
} from '@/services/http/axios'
class Category {
// 获取所有分类
async getCategories() {
const res = await get('v1/blog/category/categories')
return res
}
// 获取分类详情
async getCategory(id) {
const res = await get('v1/blog/category', {
id
})
return res
}
}
export default new Category()
3.friend.js
import {
get
} from '@/services/http/axios'
class Blog {
async getFriends() {
const res = await get('v1/blog/blog/friend/friends')
return res
}
}
export default new Blog()
4.author.js
import {
get
} from '@/services/http/axios'
class Author {
// 获取所有作者
async getAuthors() {
const res = await get('v1/blog/author/authors')
return res
}
async getAuthorDetail(id) {
const res = await get('v1/blog/author/detail', {
id
})
return res
}
}
export default new Author()