一、React项目推荐目录结构
src目录
api 接口目录
components 公共组件(或common)
pages 组件目录
orders 订单目录
components(相关组件)
store (仓库)
actionCreators.js
actionTypes.js
index.js
reducer.js
index.js (默认组件)
style.js (默认样式 import styled from 'styled-components';)
....
users 用户目录
goods 商品目录
router 路由
static 静态文件
store 全局状态(实战:1-所欲的reducer都在store目录下,2-在各自的目录中 推荐)
index.js
reducers.js
utils 扩展库(日期格式化、状态过滤) index.js 说白了这里面封装方法,其他页面导入下import
二、VUE项目推荐目录结构
src目录
api 放接口文件
components 放公共组件 例如弹框、面包屑、底部版权等
views 组件/页面
login 目录
login.vue
order
index.vue 修改就弹框
物流.vue
users
index.vue
create.vue 单独搞个组件或弹框都行
assets 放字体、图片、样式等
utils 放工具、比如之前咱们写vue移动 异步请求
filters 过滤器
store
common
state.js
getters.js
mutations.js
actions.js
order 将每个目录放到views功能下也行 同react 因为防止后期目录多了找的麻烦
...
carts
index.js export default store
...
三、自定义
目录结构可根据项目自行定义