TWorldIsNButThis

调试 dropdown 的正确姿势是?

  •  
  •   TWorldIsNButThis · Feb 12, 2023 · 1664 views
    This topic created in 1189 days ago, the information mentioned may be changed or developed.
    现在很多组件库 select 的 dropdown 都不是通过原生的 select 实现的
    focus 状态消失就立即收回去了,也无法设置 element state 触发弹出
    目前知道的一个方式就是在 console 里 setTimeout(() => {debugger}, 3000),
    然后在 3 秒内点开让它暂停在那,有没有更直接的方式?
    5 replies    2023-02-26 08:13:18 +08:00
    Baymaxbowen
        1
    Baymaxbowen  
       Feb 12, 2023 via iPhone
    css display none 干掉
    hangbale
        2
    hangbale  
       Feb 12, 2023
    Dom 断点
    BigOldBrother
        3
    BigOldBrother  
       Feb 12, 2023
    打开控制台之后,先 focus select 组件,弹出 dropdwon 之后用快捷键( cmd + shift + C )选择
    TWorldIsNButThis
        4
    TWorldIsNButThis  
    OP
       Feb 12, 2023
    @BigOldBrother 很多组件切到选中状态的时候就消失了,比如知乎首页的搜索框


    @hangbale 原理好像和 debugger 类似,不过应该触发更可控 👍
    chnwillliu
        5
    chnwillliu  
       Feb 26, 2023 via Android   ❤️ 1
    Chrome devtools 可以让页面保持停留在聚焦状态同时你还能操作 devtools. 搜 Emulate a focused page ,enable 即可。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2931 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 59ms · UTC 06:06 · PVG 14:06 · LAX 23:06 · JFK 02:06
    ♥ Do have faith in what you're doing.