Skip to content

Commit f2d8f5b

Browse files
committed
small change
1 parent 6785712 commit f2d8f5b

File tree

133 files changed

+14624
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+14624
-10
lines changed

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,22 @@
22

33
# 统一事项
44

5-
- node.js: v10.15.1
6-
- 尽量使用yarn安装 --> 不需要因为更换路径而重新安装依赖
5+
- 目前测试node.js: v10.15.1 --> 建议备注一下版本号
6+
- 尽量使用yarn安装 --> 不用因为更换了路径而重新安装依赖
77
- 打包目录名统一为dist
88
- 工程名格式统一
99

1010
```
11-
构建工具v
12-
+ js-framework
13-
+ UI/技术特点
11+
构建工具v(webpack/gulp)
12+
+ js-framework(react/vue)
13+
+ UI/技术特点(antd/elementui)
1414
+ author
15-
+ 应用场景(h5/pc/IE?)
15+
(+ simple ) --> 尽量带UI示范,没有UI的加`simple`标识一下
16+
+ 应用场景(h5/pc/IE8?)
1617
+ mpa/spa
17-
18-
尽量带UI示范,
19-
没有UI的加`simple`标识一下
2018
```
2119

22-
- 命令行统一
20+
- 命令行
2321

2422
```shell
2523
# 开发
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"presets": [
3+
"es2015",
4+
"react",
5+
"stage-0"
6+
],
7+
"plugins": [
8+
"transform-runtime"
9+
]
10+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/**/*.js
2+
node_modules/**/*.js
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"commonjs": true,
5+
"es6": true
6+
},
7+
"extends": "eslint:recommended",
8+
"globals": {
9+
"$": true,
10+
"process": true,
11+
"__dirname": true
12+
},
13+
"parser": "babel-eslint",
14+
"parserOptions": {
15+
"ecmaFeatures": {
16+
"experimentalObjectRestSpread": true,
17+
"jsx": true
18+
},
19+
"sourceType": "module",
20+
"ecmaVersion": 7
21+
},
22+
"plugins": [
23+
"react"
24+
],
25+
"rules": {
26+
"quotes": [
27+
2,
28+
"single"
29+
],
30+
"no-console": 0,
31+
"no-debugger": 2,
32+
"no-var": 0,
33+
"semi": 0,
34+
"no-irregular-whitespace": 0,
35+
"no-trailing-spaces": 1,
36+
"eol-last": 0,
37+
"no-unused-vars": [
38+
2,
39+
{
40+
"vars": "all",
41+
"args": "after-used"
42+
}
43+
],
44+
"no-underscore-dangle": 0,
45+
"no-alert": 0,
46+
"no-lone-blocks": 0,
47+
"no-class-assign": 2,
48+
"no-cond-assign": 2,
49+
"no-const-assign": 2,
50+
"no-delete-var": 2,
51+
"no-dupe-keys": 2,
52+
"no-duplicate-case": 2,
53+
"no-dupe-args": 2,
54+
"no-empty": 2,
55+
"no-func-assign": 2,
56+
"no-invalid-this": 0,
57+
"no-redeclare": 2,
58+
"no-spaced-func": 2,
59+
"no-this-before-super": 0,
60+
"no-undef": 2,
61+
"no-use-before-define": 2,
62+
"camelcase": 0,
63+
"jsx-quotes": [
64+
2,
65+
"prefer-double"
66+
],
67+
"react/display-name": 0,
68+
"react/forbid-prop-types": [
69+
2,
70+
{
71+
"forbid": [
72+
"any"
73+
]
74+
}
75+
],
76+
"react/jsx-boolean-value": 2,
77+
"react/jsx-closing-bracket-location": 1,
78+
"react/jsx-curly-spacing": [
79+
2,
80+
{
81+
"when": "never",
82+
"children": true
83+
}
84+
],
85+
"react/jsx-indent-props": [
86+
2,
87+
4
88+
],
89+
"react/jsx-key": 2,
90+
"react/jsx-max-props-per-line": [
91+
1,
92+
{
93+
"maximum": 2
94+
}
95+
],
96+
"react/jsx-no-bind": 0,
97+
"react/jsx-no-duplicate-props": 2,
98+
"react/jsx-no-literals": 0,
99+
"react/jsx-no-undef": 1,
100+
"react/jsx-pascal-case": 0,
101+
"react/jsx-sort-props": 2,
102+
"react/jsx-uses-react": 1,
103+
"react/jsx-uses-vars": 2,
104+
"react/no-danger": 0,
105+
"react/no-did-mount-set-state": 0,
106+
"react/no-did-update-set-state": 1,
107+
"react/no-direct-mutation-state": 2,
108+
"react/no-multi-comp": 0,
109+
"react/no-set-state": 0,
110+
"react/no-unknown-property": 2,
111+
"react/prefer-es6-class": 2,
112+
"react/prop-types": 0,
113+
"react/react-in-jsx-scope": 2,
114+
"react/self-closing-comp": 0,
115+
"react/sort-comp": 2,
116+
"no-extra-boolean-cast": 0,
117+
"react/no-array-index-key": 0,
118+
"react/no-deprecated": 0,
119+
"react/jsx-equals-spacing": 2,
120+
"no-unreachable": 1,
121+
"comma-dangle": 2,
122+
"no-mixed-spaces-and-tabs": 0,
123+
"prefer-arrow-callback": 0,
124+
"arrow-parens": 0,
125+
"arrow-spacing": 0,
126+
"valid-typeof": 0,
127+
"no-compare-neg-zero": 0,
128+
"no-useless-escape": 0,
129+
"no-empty-pattern": 0
130+
},
131+
"settings": {
132+
"import/ignore": [
133+
"node_modules"
134+
]
135+
}
136+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.css linguist-language=JavaScript
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
dist/
3+
.idea/
4+
.vs/
5+
.vscode/
6+
nbproject/
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Charming
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 all
13+
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 THE
21+
SOFTWARE.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# react-app-ie8
2+
- react+redux+react-router+cmui+html5+css3+less+es6+webpack+axios+eslint+兼容IE8+自写的窗口动画
3+
- 适合开发各种webapp、企业网站、后台管理系统等等任何系统
4+
- cmui仓库为https://github.com/aiplat/cmui.git
5+
- 结合hbuilder打包,可以直接做成全平台应用。例如 亲信地铁(vueapp) 腾讯应用宝或苹果appstore搜索‘亲信地铁’、web访问http://m.aiplat.com/metro
6+
-
7+
- 代码实例: ai智能空间react版 http://react.aiplat.com
8+
- 实例相对应网站1:ai智能空间vue版 https://aiplat.com
9+
- 实例相对应网站2:ai智能空间angular版 http://ajs.aiplat.com
10+
- 实例相对应网站3:ai智能空间nervjs版 http://nerv.aiplat.com
11+
12+
---
13+
14+
# 特别说明
15+
16+
## 如果你想要兼容IE8或使用最新react,只需要在package.json中使用以下版本包,package.json默认兼容IE8
17+
18+
### 兼容IE8
19+
"react": "0.x.x",
20+
"react-dom": "0.x.x",
21+
"react-redux": "^5.0.6",
22+
"react-router-dom": "^4.2.2",
23+
"redux": "^3.7.2",
24+
25+
### 使用最新react(不兼容IE8)
26+
"react": "^16.4.0",
27+
"react-dom": "^16.4.0",
28+
"react-redux": "^5.0.7",
29+
"react-router": "^4.2.0",
30+
"react-router-dom": "^4.2.2",
31+
"redux": "^4.0.0",
32+
33+
---
34+
35+
# 代码目录结构
36+
37+
### 习惯vue后,改为与vueapp类似(https://github.com/aiplat/vueapp)
38+
- build ------webpack配置目录
39+
- config ------webpack打包配置目录
40+
- dist ------npm run build后实际布署代码目录
41+
- mock ------虚拟mock目录
42+
- --- api ------静态json目录,请求地址'/api/a.json'会请到/mock/api/a.json
43+
- src ------代码主体目录
44+
- --- assets ------静态css、images、less文件目录
45+
- --- components ------公共组件目录
46+
- --- plugins ------公共函数或插件目录
47+
- --- redux ------store、reducers、action目录
48+
- --- routes ------路由配置目录
49+
- --- views ------路由对应页面视图目录
50+
- --- main.js ------应用入口文件
51+
- index.html ------单页面应用公共html入口文件
52+
53+
---
54+
55+
# clone
56+
- $ git clone https://github.com/aiplat/react-app-ie8.git
57+
58+
# 安装依赖
59+
- $ cd react-app-ie8
60+
- $ npm install
61+
62+
# 开发模式(两种)
63+
64+
### 开发模式1(热更新代码,手动刷新页面,支持IE8调试)
65+
- $ npm run dev 或 npm start
66+
67+
### 开发模式2(热更新代码,自动刷新页面,不支持IE8调试)
68+
- $ npm run dev2
69+
70+
### 最后看到以下这句 表示webpack编译成功
71+
- webpack: Compiled successfully.
72+
- 打开 http://本地ip:3008,方便手机在局域网访问
73+
74+
# 打包项目
75+
- $ npm run build
76+
- 整个项目代码打包到dist目录,已启用Gzip压缩,打开其中index.html就是项目 首页
77+
78+
# eslint
79+
- $ npm run eslint (查看)
80+
- $ npm run esfix (fix)
81+
82+
# 布署服务器(nginx) http://nginx.org/
83+
- 直接将npm run build后dist目录中文件放在服务器根目录
84+
- 若./src/main.js设置的是HashRouter,无需以下一条设置就可以正常运行网站
85+
- 若./src/main.js设置的是BrowserRouter并且是nginx服务器,设置nginx.conf如下:
86+
server {
87+
...
88+
location / {
89+
root BrowserHtml;
90+
index index.html index.htm;
91+
try_files $uri /index.html;
92+
}
93+
...
94+
}
95+
就是在 location / {} 中添加 一句:try_files $uri /index.html;
96+
97+
---
98+
99+
# 命令替换
100+
101+
### 可用cnpm代替npm
102+
- $ npm install -g cnpm --registry=https://registry.npm.taobao.org
103+
- 然后所有npm * 可用 cnpm *代替
104+
- 例如 cnpm install 、cnpm install -g ** 、cnpm install --save-dev **
105+
106+
### 可用yarn代替npm
107+
- 然后所有npm * 可用 yarn具体代码代替
108+
- 例如 yarn或yarn install 、yarn add **、 yarn add ** --dev
109+
110+
---
111+
112+
# 兼容性
113+
- PC端:使用最新react,不兼容IE8。不使用最新react,兼容IE8。
114+
- 手机端兼容安卓与ios等等各种系统,不区分机型
115+
- 兼容一切可联网设备,比如TV等等,不区分尺寸大小
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# webpack配置目录
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
修 改 人:aiplat.com
3+
新建:2018.05.14
4+
最近修改:
5+
修改描述:
6+
*/
7+
module.exports = require('./webpack.prod.conf')

0 commit comments

Comments
 (0)