1 2 3 4 5 ··· 7 下一页
摘要: webpack4打包提示文件路径不对,通过设置publicPath来解决 打包得文件如果无法实现分包,则通过设置library解决 output: { publicPath: '../', // 提示引用路径不对,那么就加上这个 path: path.join(__dirname, "./lib") 阅读全文
posted @ 2022-06-02 14:53 陈小作 阅读(168) 评论(0) 推荐(1) 编辑
摘要: 我本地使用了whistle代理,此时会无效得进行刷新请求。解决方案 在vite.config中配置 server: { host: '0.0.0.0', open: true, proxy: { ...... // 加上这个,可以解决 hmr: { protocol: 'ws', host: '12 阅读全文
posted @ 2022-06-02 14:44 陈小作 阅读(2301) 评论(1) 推荐(0) 编辑
摘要: 通过npm run analyze查看打包情况,发现chunks中包含大量的重复打包 通过提取公共chunk来实现减少打包体积以及提高打包速度 从原来的20M经过拆包之后 最终变成了4M 官方文档 https://umijs.org/zh-CN/config#chainwebpack // http 阅读全文
posted @ 2021-12-16 17:28 陈小作 阅读(816) 评论(0) 推荐(0) 编辑
摘要: 1. 项目基本准备工作 1.1 创建项目 利用npx create-react-app my_react命令创建项目 项目已经放到github:https://github.com/caozhongjie/simple-react.git 有什么不对的或者建议或者疑惑,欢迎指出! !!!在仓库代码中 阅读全文
posted @ 2021-08-26 17:15 陈小作 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 安装:yarn add redux react-redux 1、定义store文件 store.js import { createStore } from 'redux'; import reducer from './reducer'; const configureStore = () => 阅读全文
posted @ 2021-08-25 17:52 陈小作 阅读(1335) 评论(0) 推荐(0) 编辑
摘要: foo() var foo function foo() { console.log(1) } foo = function () { console.log(2) } console.log(foo) function Foo() { getName = function () { console 阅读全文
posted @ 2021-02-04 20:32 陈小作 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 1、数组去重的方式 // 数组去重实现得四种方式 let arr = [1,3,1,5,6,8,1,2,3,6] // 1、利用set() arr = [...new Set(arr)] arr = Array.from(new Set(arr)) // 2、使用includes/indexOf ( 阅读全文
posted @ 2021-02-04 20:28 陈小作 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 学习链接:https://segmentfault.com/a/1190000018428170 拉动滚动条不停触发事件,此时会触发多次该函数 function showTop() { let scrollTop = document.body.scrollTop || document.docum 阅读全文
posted @ 2021-02-02 15:43 陈小作 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 如果没有传参,那么this默认指向的window let a = { value: 1 } function parent(sex, weight) { this.name = '1' this.age = 12 this.sex = sex ? sex : null this.weight = w 阅读全文
posted @ 2021-01-20 17:32 陈小作 阅读(266) 评论(0) 推荐(0) 编辑
摘要: function Person() { this.name = 'aaa' this.info = { sex: 'boy', hobby: 'basket' } this.say = function () { console.log(111) } } Person.prototype.sing 阅读全文
posted @ 2021-01-15 16:11 陈小作 阅读(83) 评论(0) 推荐(0) 编辑
1 2 3 4 5 ··· 7 下一页