关于seajs引用问题


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


 javascript


 var 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();还可以执行
});

jquery web前端开发 seajs JavaScript

SPHALO 9 years, 1 month ago

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

脑壳灌水的鱼 answered 9 years, 1 month ago

Your Answer