coolair
V2EX  ›  问与答

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

  •  
  •   coolair · Oct 12, 2019 · 1052 views
    This topic created in 2431 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   ·   Solana   ·   1312 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 23:51 · PVG 07:51 · LAX 16:51 · JFK 19:51
    ♥ Do have faith in what you're doing.