笔记
adam_De
这个作者很懒,什么都没留下…
展开
-
create react app项目中fetch请求本地json数据报错
fetch请求本地json数据报错export const getInitToDoLists = (localUrl) => { fetch(localUrl) .then(res => res.json()) .then(data => { console.log('local data', data) })}错误提示信息如下:解决方案:将对饮的json数据置于public目录下,使用fe原创 2021-08-16 14:43:37 · 643 阅读 · 0 评论 -
mobx中observable数据更新,响应式组件未更新
mobx中observable数据更新,响应式组件未更新先上代码,说明问题:store:@observable toDoLists = []@computed get toDos() { const [ALL, DONE, UNDONE] = this.filterTypes; switch (this.filterType) { case DONE: return this.toDoLists.filter(item => !!item.don原创 2021-08-13 15:13:13 · 1349 阅读 · 0 评论 -
问题:@action.bound中的this指向
问题:@action.bound中的this指向先看代码截图:问题描述: 直接执行fn5函数,此时actionTest中返回的this指向undefined;将actionTest作为参数传入响应式组件Input,此时执行fn5函数发现this指向actionTest类思考:与observer装饰器有没有关系???对比@action, @action.bound, arrow fn, 普通函数代码如下:class ActionTest{ fn1() { consol原创 2021-08-13 14:51:18 · 746 阅读 · 0 评论 -
mobx - Leading decorators must be attached to a class declaration
mobx - Leading decorators must be attached to a class declaration当在函数组件前使用装饰器时,包如下错误错误截图如下:原创 2021-08-12 18:32:45 · 1107 阅读 · 1 评论 -
如何支持decorators属性
如何支持decorators属性1. vscode支持decorators方法1):设置vscode 方法2):添加jsconfig.json支持experimentalDecorators{ "compilerOptions": { "target": "esnext", "experimentalDecorators": true }, "exclude": ["node_modules"]}2. create-react-app支持原创 2021-08-12 18:19:31 · 77 阅读 · 0 评论 -
构建项目目录到markdown文件
构建项目目录到markdown文件安装构建工具npm install -g tree-node-cli在需要构建的项目目录下运行命令tree -L 3 > README.mdL表示目录的层级深度,保存到README.md文件中查看运行后的效果原创 2021-08-12 14:18:53 · 140 阅读 · 0 评论 -
vscode查看markdown文件
vscode查看markdown文件非常easy, follow me!!!在extensions中输入Markdown Theme Kit,点击install重启vscodectrl + shift + v 即可查看markdown文件效果ok 了原创 2021-08-12 14:07:25 · 1178 阅读 · 0 评论 -
localStorage与cookie的区别
localStorage与cookie的区别1 可允许的最大存储量 cookie单个的最大存储为4k,如果大于4k,则存储失败,浏览器中找不到对应的cookie信息; localStorage的最大存储为5m。如果大于这个最大限制浏览器提示出错2 存储时间cookie默认是会话级存储(如下图,与tab页共存亡),可以设置过期时间localStorage是持久化存储,除非主动clear掉3 可操行cookie不仅仅只是存储数据,还有其他多个属性可供其操作设置: Domain与Pa原创 2021-07-10 12:36:53 · 4359 阅读 · 0 评论