Results 16 comments of 叶子

**问题描述:** create-react-app 打包项目run build 增加进度条信息。 **解决方案:** 使用webpack plugin --- ProgressPlugin **操作:** 找到scripts目录下的build.js 增加以下代码 ``` let compiler = webpack(config); + compiler.apply(new webpack.ProgressPlugin({ + profile: true +})); ```

**问题描述:** create-react-app脚手架项目怎么添加proxy代理请求。 **解决方案:** package.json增加代理请求配置。 **操作:** 找到项目根目录下的package.json,增加以下代码 ``` // 简单单个操作,请求fetch('/api/todos'),将匹配fetch('http://localhost:4000/api/todos') "proxy": "http://localhost:4000", // 更多的配置 "proxy": { "/api": { "target": "", "ws": true // ... } } ``` 更多的配置操作请参照:https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#proxying-api-requests-in-development

@fangjj 配置了proxy之后,请求就不需要再带域名了。 `fetch('/data/cityinfo/101010100.html').then(res => res.json()).then(json => console.log(json)).catch(err => console.log(err));` 有其他问题可以加群哈。

**问题描述:** 在使用hashRouter的情况下怎么实现类似锚点跳转 **解决方案:** 使用Element.scrollIntoView() **操作:** 代码示例 ``` const scrollToAnchor = (anchorName) => { if (anchorName) { // 找到锚点 let anchorElement = document.getElementById(anchorName); // 如果对应id的锚点存在,就跳转到锚点 if(anchorElement) { anchorElement.scrollIntoView(); // 如果页面有固定header,处理顶部header遮挡title的问题 const...

@Helaiqu 去掉webpack里面的自定义主题就可以换回默认蓝色了。这个issue不做过多讨论呢,可以加群或者另开issue

**问题描述:** create-react-app脚手架增加多入口html文件 **解决方案:** [https://github.com/facebookincubator/create-react-app/issues/1084](https://github.com/facebookincubator/create-react-app/issues/1084)

**问题描述:** 在不执行npm run eject的情况下,使用异步加载组件,进行代码拆分。code-splitting-in-create-react-app **解决方案:**[https://github.com/facebookincubator/create-react-app/issues/2477](https://github.com/facebookincubator/create-react-app/issues/2477)

@davecat 是的。漏掉了,已经修复。

@blackboy1987 你改过代码? `http[funcName](params).then?` 。如果没改过,看下你有没有写对应的请求接口函数