Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GeekMiniProgram
Project
Project
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
huanglu
GeekMiniProgram
Commits
dff9ead3
Commit
dff9ead3
authored
May 12, 2020
by
huanglu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加使用方法
parent
8dfd16f0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
1 deletion
+94
-1
README.md
README.md
+93
-0
package.json
package.json
+1
-1
index.ts
src/api/index.ts
+0
-0
No files found.
README.md
0 → 100644
View file @
dff9ead3
## taro框架模板项目
### 使用方式
```
shell
fastgeek create
[
projectname]
# 选择框架 为 taro
fastgeek taro
--platform
weapp
# 微信小程序构建
fastgeek taro build
--platform
weapp
# 小程序构建
fastgeek taro deploy
--platform
weapp
# 小程序自动上传部署
fastgeek taro
[
-D
development环境]
[
-P
production环境]
[
-S
stage 环境]
```
### 项目结构介绍
-
该模板项目使用 typescript
-
mock 文件夹下放置mock数据
-
由于taro框架自身没有针对小程序的devServer,所以自己创建了一个node服务器做代理和本地mock
-
配置使用方法
```
javascript
module
.
exports
=
{
'service-gos'
:
{
// api的模块名
'GET /login'
:()
=>
{
// 接口的mock
return
{
name
:
'huanglu'
}
},
'POST /dd'
:()
=>
{
return
{
name
:
'huanglu'
}
}
},
'service-user'
:
{
'GET /config'
:
{
version
:
'1.1.10'
}
}
}
```
-
config 目录下放置的配置文件
-
build.js 放置打包、 代理、mock等配置数据
-
其他文件是 taro 框架在打包时需要的配置文件
-
本项目使用 dva 做全局状态管理
-
src/models 目录下配置全局的状态数据,在该文件夹新增model文件,会自动注入到 src/models/index.ts 文件夹下
-
在页面文件夹下,添加的model.ts 文件,会自动注入到 dva 中
-
dva 中的 modal 需要 通过 export default 方式导出
-
使用方式如下
```
typescript
type
CommonModels
=
{
count
:
number
}
export
default
<
DvaModel
<
CommonModels
>>
{
namespace
:
'common'
,
state
:
{
count
:
1
},
reducers
:
{
add
(
state
,
action
)
{
console
.
log
(
state
,
action
);
state
.
count
+=
1
;
return
{
...
state
}
}
},
effects
:
{
*
good
({
payload
},
{
call
,
put
})
{
console
.
log
(
payload
,
call
)
yield
new
Promise
((
r
)
=>
{
setTimeout
(()
=>
{
r
()
},
2000
)
})
yield
put
({
type
:
'add'
})
}
}
}
```
-
src/pages 目录下放置小程序的页面文件
-
src/subpages 目录下放置小程序的分包的目录
-
package.json 文件下 的 fastgeek 字段的值 不要删除,很重要,在 使用 fastgeek 进行编译和部署时,会使用到
\ No newline at end of file
package.json
View file @
dff9ead3
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
"typescript"
:
true
,
"typescript"
:
true
,
"css"
:
"sass"
"css"
:
"sass"
},
},
"
taro"
:
true
,
"
fastgeek"
:
"taro"
,
"scripts"
:
{
"scripts"
:
{
"build:weapp"
:
"fastgeek taro build --platform weapp"
,
"build:weapp"
:
"fastgeek taro build --platform weapp"
,
"build:swan"
:
"fastgeek taro build --platform swan"
,
"build:swan"
:
"fastgeek taro build --platform swan"
,
...
...
src/api/index.ts
0 → 100644
View file @
dff9ead3
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