coolair
V2EX  ›  问与答

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

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