Skip to content

Commit b542563

Browse files
qianyu liuqianyu liu
authored andcommitted
v1.0
0 parents  commit b542563

21 files changed

+17772
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
indent_size = 2
10+
11+
[package.json]
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.md]
16+
trim_trailing_whitespace = false

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules/*
2+
static/*
3+
turbo/*
4+
lib/echarts/*
5+
client/vendor/*
6+
server/datasource/thrift/*
7+
*.json

.eslintrc

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
"parser": "babel-eslint",
3+
"env": {
4+
"browser": true,
5+
"es6": true,
6+
"node": true
7+
},
8+
"ecmaFeatures": {
9+
"modules": true
10+
},
11+
"rules": {
12+
"brace-style": [1, "1tbs", {"allowSingleLine": true}],
13+
"camelcase": 1,
14+
//"comma-dangle": [1, "never"],
15+
"comma-spacing": [0, {"before": false, "after": true}],
16+
"comma-style": [1, "last"],
17+
"consistent-this": [1, "self"],
18+
"curly": [2, "multi-line"],
19+
"eqeqeq": [2, "allow-null"],
20+
"eol-last": 1,
21+
"guard-for-in": 0,
22+
"indent": [1, 2],
23+
"key-spacing": 0,
24+
"new-cap": [1, {"capIsNew": false, "newIsCap": true}],
25+
"new-parens": 0,
26+
"no-bitwise": 0,
27+
"no-cond-assign": 1,
28+
"no-console": 0,
29+
"no-constant-condition": 1,
30+
"no-delete-var": 2,
31+
"no-debugger": 1,
32+
"no-dupe-keys": 1,
33+
"no-duplicate-case": 1,
34+
"no-empty-character-class": 1,
35+
"no-eval": 1,
36+
"no-ex-assign": 1,
37+
"no-extend-native": 1,
38+
"no-floating-decimal": 1,
39+
"no-func-assign": 1,
40+
"no-implied-eval": 1,
41+
"no-inner-declarations": 1,
42+
"no-invalid-regexp": 1,
43+
"no-irregular-whitespace": 1,
44+
"no-iterator": 1,
45+
"no-labels": 1,
46+
"no-lonely-if": 1,
47+
"no-loop-func": 1,
48+
"no-mixed-spaces-and-tabs": 1,
49+
"no-native-reassign": 2,
50+
"no-negated-in-lhs": 1,
51+
"no-new-func": 1,
52+
"no-new-object": 1,
53+
"no-new-wrappers": 2,
54+
"no-obj-calls": 1,
55+
"no-octal": 1,
56+
"no-plusplus": 0,
57+
"no-proto": 2,
58+
"no-redeclare": 1,
59+
"no-return-assign": 1,
60+
"no-self-compare": 1,
61+
"no-sequences": 1,
62+
"no-script-url": 0,
63+
"no-shadow": 0,
64+
"no-spaced-func": 1,
65+
"no-sparse-arrays": 1,
66+
"no-throw-literal": 1,
67+
"no-trailing-spaces": 1,
68+
"no-unused-vars": [1, {"vars": "all", "args": "none"}],
69+
"no-undef": 1,
70+
"no-undefined": 2,
71+
"no-undef-init": 1,
72+
"no-underscore-dangle": 0,
73+
"no-unreachable": 1,
74+
"no-use-before-define": [1, "nofunc"],
75+
"no-warning-comments": [0, {"terms": ["todo", "fixme"]}],
76+
//"no-extra-parens": 1,
77+
"quotes": [1, "single"],
78+
"quote-props": [0, "as-needed"],
79+
"radix": 1,
80+
"semi": 0,
81+
//"keyword-spacing": [1, "always"],
82+
"space-before-blocks": [1, "always"],
83+
"space-infix-ops": 1,
84+
//"space-in-brackets": ["error", "always"],
85+
"space-in-parens": [1, "never"],
86+
//"space-return-throw-case": 1,
87+
"space-unary-ops": [1, {"words": true, "nonwords": false}],
88+
"use-isnan": 1,
89+
"valid-typeof": 1,
90+
"vars-on-top": 0, // disabled for now, see github.com/eslint/eslint/issues/2099
91+
"wrap-iife": [1, "inside"],
92+
"yoda": 0,
93+
// Node.js specific
94+
"handle-callback-err": [1, "^(err|error)$"],
95+
"no-mixed-requires": 1,
96+
"no-new-require": 1,
97+
"no-path-concat": 1,
98+
// React
99+
"react/jsx-boolean-value": 1,
100+
"react/jsx-no-undef": 1,
101+
//"react/jsx-quotes": 1,
102+
"react/jsx-sort-props": 0,
103+
"react/jsx-uses-react": 1,
104+
"react/jsx-uses-vars": 1,
105+
//"react/no-did-mount-set-state": 1,
106+
"react/no-did-update-set-state": 1,
107+
"react/no-multi-comp": 0,
108+
"react/no-unknown-property": 1,
109+
//"react/prop-types": 1,
110+
"react/react-in-jsx-scope": 1,
111+
//"react/self-closing-comp": 1,
112+
"react/jsx-wrap-multilines": 1
113+
},
114+
"plugins": [
115+
"react"
116+
]
117+
}

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
6+
# testing
7+
/coverage
8+
9+
# production
10+
/build
11+
12+
# misc
13+
.DS_Store
14+
.env.local
15+
.env.development.local
16+
.env.test.local
17+
.env.production.local
18+
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
### 记录
2+
- npm全局安装的模块放在 /usr/local/lib/node_modules/ 目录下
3+
- 不要直接对state进行修改,例如数组的一些方法会直接修改原数组
4+
- react-router4.*版本使用browerHistory的方法:[https://github.com/brickspert/blog/issues/3](https://github.com/brickspert/blog/issues/3)
5+
- 安装history[https://github.com/ReactTraining/history](https://github.com/ReactTraining/history)
6+
```
7+
const history = createHistory({
8+
forceRefresh: true,
9+
})
10+
```
11+
这样可以方便使用history,但页面跳转时是自动刷新的;
12+
- 事件函数的参数传递onClick={this.handleClick.bind(this,传递的参数)}
13+
14+
### 问题
15+
- 划分组件时,由于各个组件之前是有联系的,即 可能相互传数据,如果把其纳入一个组件会减少组件间通信,但是又会让组件显得在UI上划分不合理。如何做一个平衡?
16+
17+
### 项目逻辑
18+
1. 组件划分
19+
2. 状态state考虑(涉及到页面数据展示和页面变化)
20+
1)页面展示的数据需要state来维护,即todo数组,数组每个对象会维护多个属性;
21+
2)页面task,completed,active图标和相关todolist的展示,可以用一个状态来维护,即classify,这样可以同时控制图标的展示和相应todolist的展示;
22+
3) 状态isAdd,表示是否新增todo,控制css类名变化,即控制页面的显示;
23+
24+
### 踩坑
25+
1. 描述:history.push之后页面路径会变化,但没有跳转。所以加了forceRefresh:true的初始化参数,强制每次路径变化刷新页面。这样页面就才会有刷新。
26+
解决方法:主要我之前采用的import { BrowserRouter as Router } 加 ```<Router></Router>```的方式,现在采用```<Router history={history}></Router>```这种方式,就可以默认跳转了。
27+
28+

0 commit comments

Comments
 (0)