Skip to content

1018 今日总结

关键词: btoa 报错、面试槽点、hooks 模拟 componentDidUpdate、开源在线画板、Chrome mock 请求;

今日工作

问题,原因,解决方式,优化,巧妙实现,新知识

问题1 base64 中,btoa 方法 不支持中文

最近有朋友在做 图片转 file 文件的时候,遇到这个问题

js
btoa('hello')
// 'aGVsbG8='

btoa('hello 你好')
// // VM107:1 Uncaught DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.

btoa(encodeURIComponent('你好'))
// 'JUU0JUJEJUEwJUU1JUE1JUJE'

参考:

TOP3

其他好文

jsx
const mounted = useRef();
useEffect(() => {
  if (!mounted.current) {
    mounted.current = true;
  } else {
   console.log('I am didUpdate')
  }
});

小知识:git-pr-WIP 表示的意思: 正在开发的分支,不允许合并

项目/博客推荐

值得学习 作者/项目/工具等

博客

项目

Nest.js 专题

工具

周末有空练习了下双拼,现在还不够熟练;

感受:

  • 使用的双拼方案是:小鹤双拼;
  • 两个键就打一个字,还不习惯;连拼思维成了思维束缚;
  • 4句古诗的口诀,帮助记忆;记忆难点:v-zhi;s-ong;z-ou;t-ue/ve;p-ie
  • 确实能提升效率,前提是足够熟练的情况下;现在打字像个老人学打字...

期望:早日掌握双拼,打字速度飞速提升至正常水平;

Released under the MIT License.