正在显示
10 个修改的文件
包含
147 行增加
和
0 行删除
blank/.gitignore
0 → 100644
blank/.umirc.js
0 → 100644
blank/LICENSE
0 → 100644
1 | +The MIT License (MIT) | ||
2 | + | ||
3 | +Copyright (c) 2018-present yutingzhao1991 (yutingzhao1991@sina.com) | ||
4 | + | ||
5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | +of this software and associated documentation files (the "Software"), to deal | ||
7 | +in the Software without restriction, including without limitation the rights | ||
8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | +copies of the Software, and to permit persons to whom the Software is | ||
10 | +furnished to do so, subject to the following conditions: | ||
11 | + | ||
12 | +The above copyright notice and this permission notice shall be included in | ||
13 | +all copies or substantial portions of the Software. | ||
14 | + | ||
15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
21 | +THE SOFTWARE. |
blank/README.md
0 → 100644
blank/package.json
0 → 100644
1 | +{ | ||
2 | + "name": "@umi-block/blank", | ||
3 | + "version": "0.0.1", | ||
4 | + "description": "A blank block for quick start a umi page develop.", | ||
5 | + "main": "src/index.js", | ||
6 | + "scripts": { | ||
7 | + "dev": "umi dev" | ||
8 | + }, | ||
9 | + "repository": { | ||
10 | + "type": "git", | ||
11 | + "url": "https://github.com/umijs/umi-blocks/blank" | ||
12 | + }, | ||
13 | + "dependencies": { | ||
14 | + "react": ">=16.0.0", | ||
15 | + "umi-request": "^1.0.0" | ||
16 | + }, | ||
17 | + "devDependencies": { | ||
18 | + "umi": "^2.3.0-beta.1", | ||
19 | + "umi-plugin-block-dev": "^1.0.0", | ||
20 | + "umi-plugin-react": "^1.3.0-beta.1" | ||
21 | + }, | ||
22 | + "authors": [ | ||
23 | + "yutingzhao1991 <yutingzhao1991@sina.com>" | ||
24 | + ], | ||
25 | + "license": "ISC" | ||
26 | +} |
blank/src/_mock.js
0 → 100644
blank/src/index.js
0 → 100644
1 | +import React, { Component } from 'react'; | ||
2 | +import { Button } from 'antd'; | ||
3 | +import { connect } from 'dva'; | ||
4 | + | ||
5 | +import styles from './style.less'; | ||
6 | + | ||
7 | +// TODO: Page 修改为有意义的名称 | ||
8 | +@connect(({ page }) => page) | ||
9 | +class Page extends Component { | ||
10 | + componentDidMount() { | ||
11 | + const { dispatch } = this.props; | ||
12 | + dispatch({ | ||
13 | + type: 'page/fetch', | ||
14 | + }); | ||
15 | + } | ||
16 | + | ||
17 | + render() { | ||
18 | + const { text } = this.props; | ||
19 | + return ( | ||
20 | + <div className={styles.container}> | ||
21 | + <Button>{text}</Button> | ||
22 | + </div> | ||
23 | + ); | ||
24 | + } | ||
25 | +} | ||
26 | + | ||
27 | +export default Page; |
blank/src/model.js
0 → 100644
1 | +import { getText } from './service'; | ||
2 | + | ||
3 | +export default { | ||
4 | + namespace: 'page', // TODO: 修改为有意义的 namespace | ||
5 | + state: { | ||
6 | + text: 'loading...', | ||
7 | + }, | ||
8 | + | ||
9 | + effects: { | ||
10 | + *fetch(_, { call, put }) { | ||
11 | + const { text } = yield call(getText); | ||
12 | + yield put({ | ||
13 | + type: 'save', | ||
14 | + payload: { | ||
15 | + text, | ||
16 | + }, | ||
17 | + }); | ||
18 | + }, | ||
19 | + }, | ||
20 | + | ||
21 | + reducers: { | ||
22 | + save(state, { payload }) { | ||
23 | + return { | ||
24 | + ...state, | ||
25 | + ...payload, | ||
26 | + }; | ||
27 | + }, | ||
28 | + }, | ||
29 | +}; |
blank/src/service.js
0 → 100644
blank/src/style.less
0 → 100644
请
注册
或
登录
后发表评论