Home  >  Q&A  >  body text

javascript - 关于seajs引用问题

我想点击按钮的时候移除掉seajs的引用,该怎么做????

javascriptvar lobbydata = null;
var $firstHash = window.location.hash.substring(1) || '';

if ($firstHash == $(".indexPage").get(0).dataset.hash) {
  lobbydata = require("lobby.js").lobbyPage();
  // require("lobby.js").lobbyPage()为什么是个undefined却可以引用的了;
}

$(".page2").click(function(){
  // 想在点击的时候把lobbydata的值改为null,可是没有效果上面这个lobbydata = require("lobby.js").lobbyPage();还可以执行
});

PHP中文网PHP中文网2653 days ago373

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-04-10 15:02:11

    lobbydata = require("lobby.js").lobbyPage(); 这个应该使用异步加载的方式:lobbydata = require.async("lobby.js").lobbyPage();

    reply
    0
  • Cancelreply