随笔分类 -  React

摘要:背景 用于记录一些styled-components的有趣的用法 绑定a标签的链接 编写伪类 在styleComponents中使用参数 传入参数 阅读全文
posted @ 2023-01-17 15:03 胸怀丶若谷 阅读(30) 评论(0) 推荐(0) 编辑
摘要:解决方案 参考链接 https://v5.reactrouter.com/web/example/route-config 阅读全文
posted @ 2023-01-17 14:58 胸怀丶若谷 阅读(76) 评论(0) 推荐(0) 编辑
摘要:问题背景 在软件开发过程中,经常会出现动态添加style或className,比如:同一个表格组件在A处调用,需要固定前四列数据, B处调用则不用,那这时候,动态添加元素就派上了用场。 解决方案 如下图所示,如果不为empDetail 就选择table-head-sticky,否则就为null 参考 阅读全文
posted @ 2023-01-17 13:24 胸怀丶若谷 阅读(183) 评论(0) 推荐(0) 编辑
摘要:背景 当存在多个点击按钮时,需要提示用户点击的哪个按钮,所以要进行颜色的修改 import * as React from 'react'; import './style.css'; export default function App() { const [active, setActive] 阅读全文
posted @ 2022-11-24 13:16 胸怀丶若谷 阅读(323) 评论(0) 推荐(0) 编辑
摘要:解决方案 阅读全文
posted @ 2022-11-21 18:53 胸怀丶若谷 阅读(115) 评论(0) 推荐(0) 编辑
摘要:解决方案 echarts 注解 详细链接 https://echarts.apache.org/zh/api.html#echartsInstance.setOption 参考链接 https://blog.csdn.net/qq_37224534/article/details/113771911 阅读全文
posted @ 2022-05-09 12:39 胸怀丶若谷 阅读(441) 评论(0) 推荐(0) 编辑
摘要:解决方案 提交commit和推送代码时都加上--no-verify参数,然他跳过检查 提交 推送 阅读全文
posted @ 2022-04-28 16:50 胸怀丶若谷 阅读(193) 评论(0) 推荐(0) 编辑
摘要:配置如下 模板文本如下所示 const [$STATE$, $SET_STATE$] = useState($INITAL_STATE$) 编辑变量 SET_STATE文本如下所示 concat("set", capitalize(STATE)) 使用方法 输入usehook回车即可 参考链接 ht 阅读全文
posted @ 2022-04-26 17:50 胸怀丶若谷 阅读(191) 评论(0) 推荐(0) 编辑
摘要:说明 当使用嵌套路由时,不能在父路由中添加exact,因为要先匹配父路由才能匹配子路由 父路由 子路由 效果如下所示 参考链接 https://www.jianshu.com/p/8bc325107994 阅读全文
posted @ 2022-04-17 12:42 胸怀丶若谷 阅读(135) 评论(0) 推荐(0) 编辑
摘要:错误截图 解决方案 当你的react版本低于18时,但仍然报这个错误,可以采用如下方案 意外的发现当我采用上述方案时,我的React路由跳转时,页面不刷新的问题也解决了,很神奇,日后技艺精进再补充。 阅读全文
posted @ 2022-04-17 12:22 胸怀丶若谷 阅读(4115) 评论(0) 推荐(1) 编辑
摘要:解决方案 删除node_modules和package-lock.json,之后运行npm cache clear --force,重新安装模块npm install,另外要注意 npm 5.0版本之后,执行 npm install 的时候 就会自动生成package-lock.json文件 注意: 阅读全文
posted @ 2022-04-16 21:14 胸怀丶若谷 阅读(211) 评论(0) 推荐(0) 编辑
摘要:错误 解决方案 说白了就是版本过低,升级下就好。或者按照提示卸载掉原来的版本,之后输入临时创建命令即可,如下图所示 参考链接 https://stackoverflow.com/questions/71852370/you-are-running-create-react-app-5-0-0-whi 阅读全文
posted @ 2022-04-15 16:18 胸怀丶若谷 阅读(700) 评论(1) 推荐(0) 编辑
摘要:解决方案 npm install -S react-router-dom@5 参考链接 https://stackoverflow.com/questions/53914013/failed-to-compile-module-not-found-cant-resolve-react-router- 阅读全文
posted @ 2022-04-02 14:54 胸怀丶若谷 阅读(1230) 评论(0) 推荐(0) 编辑
摘要:警告 解决方案 对value进行判断 修改后的效果 至此问题解决 阅读全文
posted @ 2022-03-05 10:34 胸怀丶若谷 阅读(115) 评论(0) 推荐(0) 编辑
摘要:解决方案 js中?问号代表可选项 可选链式操作符 参考链接 https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator 阅读全文
posted @ 2022-03-05 10:02 胸怀丶若谷 阅读(1535) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示