coolair
V2EX  ›  问与答

使用 Require.js require 了一个使用了 window.onload 的库,发现 window.onload 并不执行,有没有在不修改原来库的情况下,执行库里面的 window.onload?

  •  
  •   coolair · Oct 12, 2019 · 1170 views
    This topic created in 2518 days ago, the information mentioned may be changed or developed.
    1 replies    2019-10-13 08:10:42 +08:00
    zjsxwc
        1
    zjsxwc  
       Oct 13, 2019 via Android
    https://requirejs.org/docs/api.html#pageload


    你再写个库封装下呗

    require(['domReady!', 'yourlib'], function (doc, yourlib) {
    window.onload();
    });
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3800 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 884cce6c · 30ms · UTC 10:18 · PVG 18:18 · LAX 03:18 · JFK 06:18
    ♥ Do have faith in what you're doing.