简体   繁体   English

通过嵌入另一个js文件导入JavaScript文件

[英]Import JavaScript file by embedding with another js file

How would I import this externaljs file by embedding the contents into another file?如何通过将内容嵌入另一个文件来导入这个外部js文件? The entire JavaScript is wrapped around with an anonymous function using arrow syntax, I thought I would be able to do by removing that and assigning it to a variable整个 JavaScript 使用箭头语法用匿名 function 包裹起来,我想我可以通过删除它并将其分配给一个变量来完成

var bundle = () => { //contents }; or using export function bundle() {//contents};或使用export function bundle() {//contents};

and calling it with bundle.htmlReport(data) , but an error is returned citing it cannot find htmlReport并用bundle.htmlReport(data)调用它,但返回一个错误,称它找不到htmlReport

JavaScript is not my forte. JavaScript 不是我的强项。

bundle does not contain a property htmlReport, nor can it contain that property because it's a function and not an object, if the arrow function returns an object htmlReport as a property then you can do bundle().htmlReport bundle does not contain a property htmlReport, nor can it contain that property because it's a function and not an object, if the arrow function returns an object htmlReport as a property then you can do bundle().htmlReport

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM