Node.js/nuxt/其他:修订间差异
来自康健生活
| 第18行: | 第18行: | ||
// 待引入的 js 文件 | // 待引入的 js 文件 | ||
module.exports = `if (window) { js文件内容... }`</syntaxhighlight> | module.exports = `if (window) { js文件内容... }`</syntaxhighlight> | ||
或者 | |||
<syntaxhighlight lang="javascript"> | |||
(function(window) { | |||
/* Keep source code the same */ | |||
// })(typeof window == "undefined" ? global : window); | |||
// or | |||
})(this);</syntaxhighlight> | |||