Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
useEffect(() => { // I've initiated Calendly in this effect }, []) console.log(window.Calendly)
当我打印 window.Calendly 时我得到了未定义,但是当我只打印 window 时,我得到了一个包含 Calendly 的对象。
效果在渲染后运行。所以你先登录,然后再设置window.Calendly。
window.Calendly
当您切换到 loggingwindow时,您现在正在记录一个对象。开发人员工具不会评估该对象中的内容,直到您单击以检查它。因此,当您单击window.Calendly时,它存在,但在运行日志语句时它并不存在。
window