Commit 14323b6d authored by lipengcheng 's avatar lipengcheng

docs: 文档更新

parent c3571edb
...@@ -46,11 +46,11 @@ npm run fix ...@@ -46,11 +46,11 @@ npm run fix
npm run prettier npm run prettier
``` ```
## 开发 ## 开发流程
### 分支
`develop`: 开发分支 `develop`: 开发分支
### 目录结构 ### 目录结构
├── CHANGELOG.md // 更新日志 ├── CHANGELOG.md // 更新日志
├── README.md ├── README.md
├── babel.config.js ├── babel.config.js
...@@ -65,7 +65,7 @@ npm run prettier ...@@ -65,7 +65,7 @@ npm run prettier
├── src // 源码目录 ├── src // 源码目录
│ ├── App.vue // 入口文件 │ ├── App.vue // 入口文件
│ ├── assets │ ├── assets
│ ├── components // 组件目录 │ ├── components // **组件目录**
│ ├── main.js │ ├── main.js
│ ├── registerServiceWorker.js │ ├── registerServiceWorker.js
│ ├── router │ ├── router
...@@ -78,6 +78,8 @@ npm run prettier ...@@ -78,6 +78,8 @@ npm run prettier
1. 页面级组件(通俗理解为与路由对应的组件)统一放在`views`目录下。 1. 页面级组件(通俗理解为与路由对应的组件)统一放在`views`目录下。
2. 页面组件内的小组件、功能组件统一放在`components`目录下。例如,页面组件`pageA.vue`中拆分出了`pageheader.vue`组件,那么在`components`目录下新建一个**与页面同名的`pageA`目录**`pageA`的相关组件放进去即可。 2. 页面组件内的小组件、功能组件统一放在`components`目录下。例如,页面组件`pageA.vue`中拆分出了`pageheader.vue`组件,那么在`components`目录下新建一个**与页面同名的`pageA`目录**`pageA`的相关组件放进去即可。
### layout布局使用
## Customize configuration ## Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/). See [Configuration Reference](https://cli.vuejs.org/config/).
**** ****
import defaultLayout from '@/components/layout/default.vue'
import layoutA from '@/components/layout/layoutA.vue'
export default [defaultLayout, layoutA]
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
<router-link to="/"> <router-link to="/">
Home Home
</router-link> </router-link>
<router-link to="/about"> <router-link to="/page1">
About page1
</router-link> </router-link>
<router-link to="/bao2"> <router-link to="/page2">
bao2 page2
</router-link> </router-link>
</div> </div>
<router-view> </router-view> <router-view> </router-view>
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
<router-link to="/"> <router-link to="/">
Home Home
</router-link> </router-link>
<router-link to="/about"> <router-link to="/page1">
About page1
</router-link> </router-link>
<router-link to="/bao2"> <router-link to="/page2">
bao2 page2
</router-link> </router-link>
</div> </div>
</template> </template>
......
import defaultLayout from '@/layout/default.vue'
import layoutA from '@/layout/layoutA.vue'
export default [defaultLayout, layoutA]
...@@ -7,7 +7,7 @@ import './assets/style/index.scss' ...@@ -7,7 +7,7 @@ import './assets/style/index.scss'
import axios from 'axios' import axios from 'axios'
import VueBus from 'vue-bus' import VueBus from 'vue-bus'
import VModal from 'vue-js-modal' import VModal from 'vue-js-modal'
import layoutComponents from '@/layout/index.js' import layoutComponents from '@/components/layout/index.js'
// 全局注册layout组件 // 全局注册layout组件
layoutComponents.forEach((layout) => Vue.component(layout.name, layout)) layoutComponents.forEach((layout) => Vue.component(layout.name, layout))
......
...@@ -7,29 +7,29 @@ Vue.use(VueRouter) ...@@ -7,29 +7,29 @@ Vue.use(VueRouter)
const routes = [ const routes = [
{ {
path: '/', path: '/',
name: 'Bao3', name: 'home',
meta: { meta: {
layout: 'DefaultLayout', layout: 'DefaultLayout',
title: '首页' title: '首页'
}, },
component: () => import(/* webpackChunkName: "about" */ '../views/bao3.vue') component: () => import(/* webpackChunkName: "about" */ '../views/home.vue')
}, },
{ {
path: '/bao2', path: '/page1',
name: 'Bao2', name: 'Page1',
component: () => import(/* webpackChunkName: "about" */ '../views/bao2.vue') component: () => import(/* webpackChunkName: "about" */ '../views/page1.vue')
}, },
{ {
path: '/about', path: '/page2',
name: 'About', name: 'page2',
meta: { meta: {
layout: 'layout-a', layout: 'layout-a',
title: '页面1' title: '页面2'
}, },
// route level code-splitting // route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route // this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited. // which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue') component: () => import(/* webpackChunkName: "about" */ '../views/page2.vue')
} }
] ]
......
<template> <template>
<div class="comp-bao2"> <div class="comp-bao2">
<h2>bao2</h2> <h1>home</h1>
</div> </div>
</template> </template>
......
<template> <template>
<div class="comp-bao2"> <div class="page1">
<h1>bao3</h1> <h1>页面1</h1>
</div> </div>
</template> </template>
......
<template> <template>
<div class="about"> <div class="page2">
<!-- <default-layout></default-layout> <h1>页面2</h1>
<layout-a></layout-a> -->
<h1>about</h1>
</div> </div>
</template> </template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment