[英]how to export functions that use non exported function in the same file?
I want to import functions that use other non-exported functions and variables that located in the same file like the following example:我想导入使用位于同一文件中的其他非导出函数和变量的函数,如下例所示:
File 1:文件 1:
function foo(number){
return number + 10;
}
var shoo = 20;
function boo(){
return foo(1) + shoo;
}
export{boo};
File 2:文件2:
import { boo } from 'File 1';
console.log(boo());
hope this example clear希望这个例子清楚
can you help me?你能帮助我吗?
Use your import in a module script like this在这样的模块脚本中使用您的导入
<script type="module">
import { boo } from 'File 1';
console.log(boo());
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.