4

JavaScript 实现的 Diolog 弹框的库,是基于什么原因考虑, 才会『基于内容的数据类型,...

 3 years ago
source link: https://www.v2ex.com/t/797656
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
JavaScript 实现的 Diolog 弹框的库,是基于什么原因考虑, 才会『基于内容的数据类型,使用不同的默认的弹框关闭方式』?
9 条回复    2021-08-24 15:16:57 +08:00

xarthur

xarthur   1 天前   ❤️ 1

估计是有性能上的考量,remove DOM element 是相对来说更加耗时的。

dcoder

dcoder   1 天前   ❤️ 1

Diolog: 我不做 Dialog 了!!!

manyfreebug

manyfreebug   1 天前

@xarthur 那为什么不统一使用更节省性能(hide()方法)的方式呢?

eason1874

eason1874   23 小时 41 分钟前   ❤️ 1

@manyfreebug #3 全部用 hide 那每一次弹窗提示就多一个弹窗 DOM,当控制台使用几个小时下来 DOM 数量得爆炸。如果要二取一,只能是 remove

我觉得设计逻辑是:需要用到 DOM 的是交互功能(可能复用),HTML 字符串通常是提示(看完就没用了)

这个组件库体验感不错,简约,大方,素雅

aasdkl

aasdkl   23 小时 36 分钟前   ❤️ 1

应该就是组件库自己的约定吧
如果你的 content 是 string,我就认为你这个 dialog 是一次性的,就直接销毁
不然我就认为你这个 dialog 是需要反复使用的,就保留下来

1343EFF

1343EFF   23 小时 26 分钟前   ❤️ 1

这是阅文大佬张鑫旭搞得框架吧,之前好像看见过

Variazioni

Variazioni   23 小时 25 分钟前   ❤️ 1

dialog 。。我之前也老记错。。

ccyu220

ccyu220   21 小时 47 分钟前

通俗的解释是 “释放内存”

关于   ·   帮助文档   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   2821 人在线   最高记录 5497   ·  

创意工作者们的社区

World is powered by solitude

VERSION: 3.9.8.5 · 18ms · UTC 05:03 · PVG 13:03 · LAX 22:03 · JFK 01:03
♥ Do have faith in what you're doing.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK