V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
coolair
V2EX  ›  问与答

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

  •  
  •   coolair · 2019-10-12 18:05:44 +08:00 · 682 次点击
    这是一个创建于 1650 天前的主题,其中的信息可能已经有所发展或是发生改变。
    1 条回复    2019-10-13 08:10:42 +08:00
    zjsxwc
        1
    zjsxwc  
       2019-10-13 08:10:42 +08:00 via Android
    https://requirejs.org/docs/api.html#pageload


    你再写个库封装下呗

    require(['domReady!', 'yourlib'], function (doc, yourlib) {
    window.onload();
    });
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3124 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 14:22 · PVG 22:22 · LAX 07:22 · JFK 10:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.