urlArgs: function (id, url) { var args = document.getElementById('grayParam').innerText; return (url.indexOf('?') === -1 ? '?' : '&') + 'system=plus' + args; }, urlArgs:附加到RequireJS用於獲取資源的URL的額外查詢字符串參數。當瀏覽器或服務器配置不正確時,最有用的是緩存破壞。urlArgs的緩存實例緩存設置示例: urlArgs: "bust=" + (new Date()).getTime() 根據RequireJS 2.2.0,urlArgs能夠是一個函數。若是一個函數,它將接收模塊ID和URL做爲參數,它應該返回一個字符串,該字符串將被添加到URL的末尾。若是沒有參數,返回一個空字符串。必定要照顧加入'?' 或「&」,具體取決於URL的現有狀態。例: requirejs.config({ urlArgs: function(id, url) { var args = 'v=1'; if (url.indexOf('view.html') !== -1) { args = 'v=2' } return (url.indexOf('?') === -1 ? '?' : '&') + args; } }); 在開發過程當中,使用此功能很是有用,但請務必在部署代碼以前將其刪除。 urlArgs: Extra query string arguments appended to URLs that RequireJS uses to fetch resources. Most useful to cache bust when the browser or server is not configured correctly. Example cache bust setting for urlArgs: urlArgs: "bust=" + (new Date()).getTime() As of RequireJS 2.2.0, urlArgs can be a function. If a function, it will receive the module ID and the URL as parameters, and it should return a string that will be added to the end of the URL. Return an empty string if no args. Be sure to take care of adding the '?' or '&' depending on the existing state of the URL. Example: requirejs.config({ urlArgs: function(id, url) { var args = 'v=1'; if (url.indexOf('view.html') !== -1) { args = 'v=2' } return (url.indexOf('?') === -1 ? '?' : '&') + args; } }); During development it can be useful to use this, however be sure to remove it before deploying your code.