模块引入,以下写法是否有错误??为什么没有弹框~~
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1></h1>
<!-- <script type="module" src="./main.js"></script> -->
<script type="module" src="./hello.js">
</script>
</body>
</html>
hello.js
import * as hello from './sayHello';
hello.sayHello('Jack')
sayHello.js
export function sayHello(name) {
alert(`Hello :${name}`);
}
import * as hello from './sayHello.js';