Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

import 和 export在同文件下的问题

图片.png
这种要怎么解决啊

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <script src="./main/A.js" type="module"></script>
    <script src="./main/B.js" type="module"></script>
</body>
</html>

只是简单的导入和导出


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

需要放到 Web Server 下以 HTTP 形式访问,你这是一看就是资源管理器里直接双击本地打开的。

如果自己不会搭 Web Server,VSCode 里可以装个 LiveServer 插件,内置了一个简单的 HTTP Web Server。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...