提交 068036a0fdb9af22ea425dc7cfebaa8861d0fd87

作者 愚道
1 个父辈 f014ccba

blank block use BLOCK_NAME

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