We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b2877ad commit bf19144Copy full SHA for bf19144
docs/module.md
@@ -190,7 +190,7 @@ foo()
190
191
```javascript
192
// main.js
193
-import {firstName, lastName, year} from './profile';
+import {firstName, lastName, year} from './profile.js';
194
195
function setName(element) {
196
element.textContent = firstName + ' ' + lastName;
@@ -202,7 +202,7 @@ function setName(element) {
202
如果想为输入的变量重新取一个名字,`import`命令要使用`as`关键字,将输入的变量重命名。
203
204
205
-import { lastName as surname } from './profile';
+import { lastName as surname } from './profile.js';
206
```
207
208
`import`后面的`from`指定模块文件的位置,可以是相对路径,也可以是绝对路径,`.js`后缀可以省略。如果只是模块名,不带有路径,那么必须有配置文件,告诉 JavaScript 引擎该模块的位置。
0 commit comments