- 博客(67)
- 收藏
- 关注
转载 npm设置代理
npm设置仓库1.npm config set registry https://registry.npm.taobao.org npm config list #查看npm当前配置 2.命令行指定 每次执行命令前加入–registry指定仓库路径npm --registry http://172.17.216.121 install3.编辑 ~/.npmrc 加入下面内容regis...
2019-09-02 19:00:00
308
转载 使用npm link关联自己的node modules(项目)
在进行自己的模块开发时,一般我们至少会创建2个项目,一个项目进行自己的modules开发(项目aaa)。另一个项目引入自己开发的modules,进行测试并使用(项目bbb)。这时我们就可以使用npm link关联2个模块:1:进入aaa项目,输入npm link,这时npm会把项目aaa暴露到全局。2:进入bbb项目,输入npm link aaa,这时bbb项目就不会使用...
2019-08-29 10:30:00
1979
转载 高版本的angular cli(2以上)如何使用ng eject
在creact react中有eject来暴露出配置文件,但是在angular cli中却只有1.X版本的cli有这个功能https://github.com/angular/angular-cli/wiki/1-x-home2版本以上都没有了https://github.com/angular/angular-cli/wiki(真的坑...官方也没提供个解决方案)那么如果...
2019-08-15 18:05:00
769
转载 关于redux-observable的一点理解
推荐2篇个人觉得写的还不错的文章吧redux-observable介绍及和redux-thunk,redux-saga的区别:https://www.jianshu.com/p/c1adaa9d8a39使用 redux-observable 实现组件自治:https://juejin.im/post/5b798501f265da43473130a1说点题外话:也许可...
2019-07-22 22:48:00
511
转载 Type error: Cannot compile namespaces when the '--isolatedModules' flag is provided.
在使用create-react 构件的TS项目时如果我们想导入一个普通的 .js文件会有以下报错Failed to compileC:/Users/JH55692/rendition_ui/public/readership/adobe/AppMeasurement.jsType error: Cannot compile namespaces when the '--iso...
2019-07-05 17:16:00
3988
转载 react-create-app src引入目录外部文件冲突问题:Relative imports outside of src/ are not supported....
使用react-create-app构建的项目,当src文件夹下文件想引用src文件夹外文件因为官方限制问题会报以下错误。Module not found: You attempted to import ****** which falls outside of the project src/ directory. Relative imports outside of src/...
2019-07-05 15:32:00
4179
转载 React 的性能优化 PureComponent 与 ImmutableJS
详见:https://segmentfault.com/a/1190000011408775转载于:https://www.cnblogs.com/jimaww/p/11102882.html
2019-06-28 15:23:00
243
转载 react服务端渲染详解
详见1:https://www.jianshu.com/p/47c8e364d0bc?appinstall=1&mType=Group及2:https://segmentfault.com/a/1190000018672269#articleHeader14react官方:https://zh-hans.reactjs.org/docs/react-dom-server....
2019-06-23 03:08:00
134
转载 react event.persist()
如果在react中想异步访问事件属性(如在setTimeout内),应该在是处理事件时调用event.persist(),这会从事件池中移除该合成函数并允许对该合成事件的引用被保留下来。详见:https://reactjs.org/docs/events.html#event-pooling转载于:https://www.cnblogs.com/jimaww/p/11041344...
2019-06-17 18:13:00
1506
转载 npm删除项目所有依赖和清缓存
清缓存的办法,一个是 npm cache verify, 还有一个方法npm cache clean --force删除项目所有依赖npm uninstall *转载于:https://www.cnblogs.com/jimaww/p/10985921.html
2019-06-06 16:56:00
7242
转载 前端性能测试之lighthouse
记录一款简单好用的前端性能测试工具:https://github.com/GoogleChrome/lighthouse这是一款基于chorme的测试工具,使用很简单:1 使用npm全局安装2 安装好后在cmd里运行:lighthouse http://localhost:3000 --view --emulated-form-factor desktop-thrott...
2019-05-24 11:28:00
611
转载 CSS实现水平垂直居中的各种方式
原文地址:https://segmentfault.com/a/1190000016389031个人觉得比较好的是通过flex布局来实现,代码简单,且不受具体宽度和高度的影响:#modal-root { /*弹性盒模型*/ display: flex; /*主轴居中对齐*/ ...
2019-05-07 18:16:00
131
转载 如何去除button选中时的阴影效果
使用box-shadow可以去除button选中时四周的阴影。CSS代码如下(&是sass语法,即当前button元素):button { box-shadow: none; -webkit-box-shadow: none; -moz-box-shadow: none; -o-box-shadow: none; -ms-box-shadow: n...
2019-04-17 13:56:00
4907
转载 在react的TS项目中定义defaultProps
如何在react的TS项目中定义组件的defaultProps,代码如下:import React, { Component } from 'react';import '../../../style/animation/loading.scss';interface ILoadingProps { scale?: number;}interface...
2019-04-11 18:01:00
891
转载 在用npm install jquery-ui之后如何引入项目并使用
在用webpack或者creact react 构建的前端项目中,如果我们要用jquery-ui一定要像如下这样:import $ from 'jquery'; //必须引入jqueryimport 'jquery-ui/themes/base/draggable.css'; //此css不引入也不影响draggable 功能import 'jquery-ui/them...
2019-04-09 10:58:00
1927
转载 React 组件间通讯
转自:http://taobaofed.org/blog/2016/11/17/react-components-communication/转载于:https://www.cnblogs.com/jimaww/p/10647931.html
2019-04-03 11:51:00
112
转载 在TypeScript中如何在window上定义对象
比如我们要在window上定义 Jim最简单的方法就是将window强制类型转换成any,但是不推荐!(window as any).Jim=233;推荐方法:在项目中找到*.d.ts 文件 加上以下代码即可:interface Window { Jim: any; //注意这里如果不写any那么用window.jim是可以的,但是用window.j...
2019-03-20 10:28:00
9087
转载 在react typescript项目中如何使用没有@type定义的npm包
最近在用react重构我们的Angularjs项目,我使用的是create react-app 构建的 使用typescript的react项目其中遇到一个问题就是有的npm包比如: react-loadable 在npm上是没有@types/react-loadable的那么我们如何在符合TS语法的基础上引入这个包呢?首先正常npm install react-loadable...
2019-03-08 16:15:00
618
转载 React Loadable结合React Router 4并实现动态加载和模块热替换
基于react原生的代码动态分离:https://reactjs.org/docs/code-splitting.htmlReact Loadable - 以组件为中心的代码分割和懒加载:https://www.jianshu.com/p/697669781276升级到 React Router 4 并实现动态加载和模块热替换:https://www.jianshu.com/p/...
2019-03-08 15:33:00
175
转载 关于react循环渲染中的key
在react中使用map或者其他方法生成DOM时经常看到如下警告:index.js:1446 Warning: Each child in an array or iterator should have a unique "key" prop. See https://fb.me/react-warning-keys for more information.这是因为我们没有为...
2019-02-28 16:39:00
300
转载 React Router 4 与 之前版本(3)的区别
详见:https://www.jianshu.com/p/bf6b45ce5bcc转载于:https://www.cnblogs.com/jimaww/p/10412347.html
2019-02-21 14:32:00
281
转载 关于前端性能优化(Start Render、DOM Ready、Page Load、TTI)
首先了解一下基本概念:前端性能指标分析-Start Render、DOM Ready、Page Load、TTI前端性能量化标准:这篇回答说了一些测量的标准,及测量工具知乎上一篇个人觉得还不错的(其中某些部分可能有点老了,但也写的很透彻了)具体回答了如何优化:网站为什么 JS 调用尽量放到网页底部?知乎https://www.zhihu.com/ques...
2019-01-22 15:19:00
500
转载 create-react-app的打包后index页面内引用其他资源的路径问题
在使用create react build项目时,发现build的目录内的js,css引用使用的地址前面使用的是/XXX而不是./XXX这就导致了引用资源的地址无效/ 表示根目录./ 表示当前目录../表示父级目录修复方法有多种:最简单的是在package.json内定义一个"homepage":"."即可其他方法见:https://github...
2019-01-11 17:51:00
340
转载 webpack生成默认HTML页面之html-webpack-plugin
详见:https://segmentfault.com/a/1190000007126268#articleHeader6解释了如何通过webpack在build时将index.ejs(或其他模板文件)转成index.html并插入打包好的相关css,js标签到index页面的指定位置(如:head,body)。转载于:https://www.cnblogs.com/jimaw...
2019-01-11 15:08:00
155
转载 Linux常用命令
首先要明白bash是什么:shell是一个程序,可以称之为壳程序,用于用户与操作系统进行交互。用来区别与核,相当于是一个命令解析器,Shell有很多中,这里列出其中几种 - Bourne SHell(sh) - Bourne Again SHell(bash) - C SHell(csh) - KornSHell(ksh) - zsh各个shell的功能都差不太多,在某些语法的下...
2019-01-07 17:23:00
128
转载 Cache-Control和Expires无效的原因
在用chrome访问一个网站时会发现不同的请求有的被缓存了有的没有,但他们都有相同的Response Header信息比如:Accept-Ranges:bytesCache-Control:public, max-age=31295475Connection:Keep-AliveContent-Language:enContent-Length:15448...
2019-01-07 16:35:00
2875
转载 git cherry-pick 将某个commit改动拉出来重新提交到不同分支
有以下情况:比如我们基于1月份的主分支建了一个3月份的主分支,我们已经基于3月份的主分支建了自己的分支并merge了一个自己的分支进去。但是现在有需求上patch所以基于1月份的主分支建了一个2月份主分支,哪么如何把3月份我们commit和merge的分支在2月份重新提交呢,这时就可以使用git cherry-pick将某个commit改动拉出来重新提交到不同分支(只包含当前com...
2019-01-03 11:51:00
1580
转载 switch case多值匹配
在高性能jiavascript一书中提到switch性能比if-else好,但是如何switch在一个case里面写多个条件呢:switch case多值匹配一般有两种情况1.列举(将所有值列举出来)var n= 3;switch (n){ case 1: case 2: case 3: console.log("0~3"); ...
2018-12-28 17:05:00
1968
转载 webpack的devtool——调试代码的方式
首先:devtool是干什么的?Choose a developer tool to enhance debugging.其实就是选择一种调试代码的方式详见:webpack——devtool里的7种SourceMap模式转载于:https://www.cnblogs.com/jimaww/p/10180893.html...
2018-12-26 18:19:00
305
转载 利用webpack实现热更新
webpack中webpack-dev-server是一个简单的web服务器,可以帮助我们实现代码的热更新,即在实际开发中只需保存修改完后的代码,不用手动刷新页面就可以看到效果。在使用webpack-dev-server时,会发现在对js、css文件中的代码修改时,可以很容易地实现页面热更新;修改html文件内容时,保存代码,页面并没有自动更新。(可以在html-hot-reload项目...
2018-12-26 17:42:00
96
转载 TypeScript 基本语法和入门教程
TypeScript 基本语法:https://www.cnblogs.com/xcong/p/4570235.htmlTypeScript入门教程:http://www.jqhtml.com/8076.html转载于:https://www.cnblogs.com/jimaww/p/10179916.html
2018-12-26 16:33:00
153
转载 package-lock.json 与 package.json
package-lock.json 与 package.json 关系:https://blog.csdn.net/shang_gege/article/details/80276910什么是package-lock.json(官方文档解释):https://blog.csdn.net/ssfz123/article/details/79627095转载于:https://www...
2018-12-26 15:35:00
78
转载 package.json字段全解
原文地址:https://blog.csdn.net/woxueliuyun/article/details/39294375转载于:https://www.cnblogs.com/jimaww/p/10179409.html
2018-12-26 15:30:00
59
转载 package.json文件中dependencies和devDependencies的区别
首先,两个都是此项目的依赖。那 package.json 文件里面的devDependencies 和dependencies 对象有什么区别呢?dependencies 是需要发布到生产环境的,而devDependencies 里面的插件只用于开发环境,不用于生产环境。dependencies是项目正常运行所需要的依赖,而devDependencies则是开...
2018-12-26 15:28:00
299
转载 Node.js中package.json中库的版本号详解(^和~区别)
当我们查看package.json中已安装的库的时候,会发现他们的版本号之前都会加一个符号,有的是插入符号(^),有的是波浪符号(~)。那么他们到底有什么区别呢?先贴一个例子,对照例子来做解释:"dependencies": { "bluebird": "^3.3.4", "body-parser": "~1.15.2" }bluebird的版本号:^3.3.4bo...
2018-12-26 15:20:00
85
转载 关于async,defer,ready,onload的部分总结
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>summary</title> <script src="https://code.jquery.com/jquery-3.1.1.min.js"&g...
2018-12-25 15:35:00
493
转载 webpack的entry,output及CommonsChunkPlugin
在webpack中可以通过设置entry,output以及结合CommonsChunkPlugin 来实现打包时,业务代码和第三方代码的分离部分相关(黄色)webpack.config.js代码如下:var webpack = require('webpack');var path = require('path');var buildPath = path.res...
2018-12-20 15:48:00
82
转载 关于跨域和同源策略
服务器端的请求是不涉及跨域的,跨域是浏览器的同源策略导致的。浏览器为什么要设计同源策略?https://www.zhihu.com/question/31459669前端跨域知识总结:http://web.jobbole.com/88519/JS中的跨域问题:https://www.cnblogs.com/yongshaoye/p/7423881.html转载于:http...
2018-12-20 14:42:00
103
转载 IE下设置document.domain造成无法和子Iframe通信的解决方法
在IE下如果父页面设置了document.domain = document.domain;即使子页面iframe和父页面同源,父子页面也无法通信,此时需在子页面也加上 document.domain = document.domain;在子页面判断是否可和父页面通信及修复的完整代码如下(就用上面的document.domain = document.domain也可达到同样目的...
2018-12-18 10:35:00
208
转载 如何循环遍历document.querySelectorAll()方法返回的结果
使用JavaScript的forEach方法,我们可以轻松的循环一个数组,但如果你认为document.querySelectorAll()方法返回的应该是个数组,而使用forEach循环它:/* Will Not Work */document.querySelectorAll('.module').forEach(function() { });执行上面...
2018-12-18 10:04:00
689
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人