提交 068036a0fdb9af22ea425dc7cfebaa8861d0fd87

作者 愚道
1 个父辈 f014ccba

blank block use BLOCK_NAME

... ... @@ -14,6 +14,7 @@ module.exports = {
14 14 page: true,
15 15 },
16 16 rules: {
  17 + 'import/prefer-default-export': 0,
17 18 'react/jsx-filename-extension': [1, { extensions: ['.js'] }],
18 19 'react/jsx-wrap-multilines': 0,
19 20 'react/prop-types': 0,
... ... @@ -21,7 +22,7 @@ module.exports = {
21 22 'react/jsx-one-expression-per-line': 0,
22 23 'import/no-unresolved': [2, { ignore: ['^@/', '^umi/'] }],
23 24 'import/no-extraneous-dependencies': [
24   - 2,
  25 + 1,
25 26 {
26 27 optionalDependencies: true,
27 28 devDependencies: ['**/tests/**.js', '/mock/**.js', '**/**.test.js'],
... ...
1 1 export default {
2   - 'GET /api/text': {
  2 + 'GET /api/BLOCK_NAME/text': {
3 3 text: 'I am a blank block',
4 4 },
5 5 };
... ...
... ... @@ -4,13 +4,12 @@ import { connect } from 'dva';
4 4
5 5 import styles from './style.less';
6 6
7   -// TODO: Page 修改为有意义的名称
8   -@connect(({ page }) => page)
  7 +@connect(({ BLOCK_NAME }) => BLOCK_NAME)
9 8 class Page extends Component {
10 9 componentDidMount() {
11 10 const { dispatch } = this.props;
12 11 dispatch({
13   - type: 'page/fetch',
  12 + type: 'BLOCK_NAME/fetch',
14 13 });
15 14 }
16 15
... ...
1 1 import { getText } from './service';
2 2
3 3 export default {
4   - namespace: 'page', // TODO: 修改为有意义的 namespace
  4 + namespace: 'BLOCK_NAME',
5 5 state: {
6 6 text: 'loading...',
7 7 },
... ...
1 1 import request from 'umi-request';
2 2
3 3 export function getText() {
4   - return request('/api/text');
  4 + return request('/api/BLOCK_NAME/text');
5 5 }
... ...
注册登录 后发表评论