![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
前端学习随笔
「已注销」
这个作者很懒,什么都没留下…
展开
-
解决在 React + TS项目中使用 scss 报 cannot find module ‘xxx.scss‘ 的问题
使用 create-react-app 的创建的项目,其默认的 webpack.config.js (这个文件默认隐藏,要查看需要运行 npm run eject,运行这个命令前需要本地 commit 代码)的文件中,是默认配置了 sass-loader 的选项的,所以在 react 项目中使用 sass 还是比较方便的。虽然默认配置了 sass-loader,但要使用 sass 还是需要先安装一下的npm install sassoryarn add sass安装好依赖后,就可以把样式文件改为.原创 2022-01-27 16:48:28 · 2853 阅读 · 2 评论 -
TypeScript中用单例模式封装 localStorage
class LocalStorageUtil { private constructor() {} // 单例模式中,给构造函数添加 private 修饰符是必要的 public static storageInstance: LocalStorageUtil; public static createInstance() { if (!this.storageInstance) { this.storageInstance = new LocalStorageUtil() }原创 2022-01-13 17:23:08 · 388 阅读 · 1 评论