Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

zzhiren/Learning

Repository files navigation

目录


每周解决一个问题,问题可以是不懂的,理解模糊的,工作中遇到的需求等~

  • 防抖和节流(已完成)
  • Web元素拖动效果(待完成)
  • Vue骨架屏(待完成)

1.1 防抖debounce,节流throttle(完成)

什么是防抖和节流?

大多数情况下函数在短时内只需要触发一次即可,但是由于用户操作问题短时间内大量触发函数导致, 而实际只需要第一次或者最后一次触发的结果,中间的函数触发没有意义,这就导致了性能浪费。

1.2 Web元素拖动效果

1.3 Vue骨架屏


2.1 比较好的文章博客

2.2 贪婪模式和非贪婪模式

如下示例中贪婪与非贪婪模式区别是在匹配字符时

贪婪模式

贪婪模式会匹配最大长度的字符串

# 第一版 查找出《以父之名》
# 开头 <div id="001" class="box">
# 结尾 </div>
def find_yfzm():
 print('找出以父之名歌曲')
 pattern = r'(?<=<div title="以父之名" class="box">)[\s\S]*(?=</div>)'
 print(pattern)
 print(re.findall(pattern, fo))

非贪婪模式

非贪婪模式匹配最小长度的字符串

def find_yfzm():
 print('找出以父之名歌曲')
 pattern = r'(?<=<div title="以父之名" class="box">)[\s\S]*?(?=</div>)'
 print(pattern)
 print(re.findall(pattern, fo))

2.3 固化分组 (?>...)

固化分组内的字符串匹配成功后将不会被后续匹配规则进行回溯,相当于锁定。

About

😋Learning~

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors

AltStyle によって変換されたページ (->オリジナル) /