Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-cli
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gic-web
gic-cli
Commits
525f205f
Commit
525f205f
authored
Oct 31, 2022
by
caoyanzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: gic-cli
parent
0f7da6e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
4 deletions
+65
-4
README.md
README.md
+65
-4
No files found.
README.md
View file @
525f205f
# 新建项目
*
先执行
`git clone http://git.gicdev.com/gic-web/gic-cli.git`
获取脚手架模板
*
然后将代码复制到项目目录,即可完成项目初始化
*
然后打开
`@/config/index.js`
,修改projectName,值既是项目发布后的真实路径,也是请求参数的requestProject
*
然后打开
`@/config/public-path.js`
,修改publicPath,值是项目发布后的真实路径
# 项目中升级脚手架
> `npm run update-cli`
> `npm run update-cli`
暂未实现
# 脚手架功能说明
*
提供请求方法
*
提供全局指令
*
提供format方法
*
支持less、scss
*
使用eslint规范,代码提交前进行校验,校验不通过将无法提交代码
*
使用指定的vue、vue-complier、element-ui版本
## 提供请求方法
*
先在
`@/src/apis.js`
中定义请求方法
```
javascript
import
{
request
}
from
'../utils/request.js'
;
// 定义api请求方法
export
const
getUserInfo
=
request
(
'/api-auth/get-login-user-info'
);
```
*
然后在vue文件中调请求方法
```
javascript
import
{
getUserInfo
}
from
'@/apis.js'
;
// 调用
getUserInfo
({
requestData
:
'test'
}).
then
()
```
## 提供全局指令
```
javascript
<
template
>
<
div
>
<
div
v
-
loadmore
=
"onLoadMore"
><
/div
>
<
div
v
-
loadmore
:[
target
]
=
"onLoadMore"
>
<
div
id
=
"test"
><
/div
>
<
/div
>
<
/div
>
<
template
>
<
script
>
export
default
{
data
()
{
return
{
target
:
'#test'
}
}
}
<
/script
>
```
## 提供format方法
```
javascript
<
template
>
<
div
>
<
div
>
{{
formatters
.
formatDate
(
Date
.
now
(),
'yyyy-MM-dd'
)
}}
<
/div
>
<
div
>
{{
formatters
.
formatDate
(
Date
.
now
(),
'MM-dd'
)
}}
<
/div
>
<
div
>
{{
formatters
.
formatDate
(
Date
.
now
(),
'HH:mm:ss'
)
}}
<
/div
>
<
/div
>
<
/template
>
<
script
>
export
default
{
inject
:
[
'formatters'
]
}
<
/script
>
```
## 提供缓存策略
*
通过路由配置实现页面缓存
```
javascript
const
routes
=
{
path
:
'/list'
,
component
:
()
=>
import
(
'./list.vue'
),
meta
:
{
// 需要缓存的页面组件的name
componentName
:
'List'
,
// 从fromPath路径进入页面,将会使用缓存,保留页面的查询参数等状态
fromPath
:
[
'/edit'
,
'/detail'
]
}
}
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment