Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新'快速上手'页面. #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 30 additions & 16 deletions site/zh/doc/d2-admin/learn/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ npm run serve

## 新建页面

`src/pages` 目录是页面存放目录,在此目录下新建目录,例如 **page-demo**:
`src/views` 目录是页面存放目录,在此目录下新建目录,例如 **page-demo**:

![](https://qiniucdn.fairyever.com/20180729095509.png?imageMogr2/auto-orient/thumbnail/1480x/blur/1x0/quality/100|imageslim)
![](http://tuchuang.keysking.com/20191231215232.png)

然后在文件夹内新建 **index.vue** 文件:

Expand All @@ -147,19 +147,19 @@ npm run serve

上面的代码生成了一个带有 header 和 footer 的页面,页面内容只有一句话,如果您好奇为什么这么写,可以参考 [页面容器](../sys-components/container.md)

![](https://qiniucdn.fairyever.com/20180729095919.png?imageMogr2/auto-orient/thumbnail/1480x/blur/1x0/quality/100|imageslim)
![](http://tuchuang.keysking.com/20191231215700.png)

## 设置路由

`src/router/routes.js` 是路由配置文件。

在 `frameIn` 变量最后添加
在 `frameIn` 变量的 `children` 数组最后添加

``` js
{
path: '/page-demo',
name: 'page-demo',
component: () => import('@/pages/page-demo'),
component: _import('page-demo'),
meta: {
auth: true,
title: '新建示例'
Expand All @@ -169,35 +169,49 @@ npm run serve

最后 `frameIn` 变量应该是这样:

``` js {23-31}
``` js {37-45}
const frameIn = [
{
path: '/',
redirect: { name: 'index' },
component: layoutHeaderAside,
children: [
// 首页
{
path: 'index',
name: 'index',
meta,
component: () => import('@/pages/index')
meta: {
auth: true
},
component: _import('system/index')
},
// ...
// ......
{
path: '/page3',
path: 'page3',
name: 'page3',
component: () => import('@/pages/page3'),
meta: {
auth: true,
title: '页面 3'
}
title: '页面 3',
auth: true
},
component: _import('demo/page3')
},
// 系统 前端日志
{
path: 'log',
name: 'log',
meta: {
title: '前端日志',
auth: true
},
component: _import('system/log')
},
// ......
{
path: '/page-demo',
name: 'page-demo',
component: () => import('@/pages/page-demo'),
component: _import('page-demo'),
meta: {
auth: true,
auth: true,
title: '新建示例'
}
}
Expand Down