问题描述
大约一年以前我使用过流星,现在我想再次使用它,但是很多事情都发生了变化。
About a year ago I have used Meteor, and now I want to use it again, but many things have changed.
当我遵循Blaze .com,他们在他们的文件之上添加导入:
When I follow the Blaze tutorial on Meteor.com, they add imports on top of their files:
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { ReactiveDict } from 'meteor/reactive-dict';
我的应用程序正常工作。但是当我注释出口时,该应用程序继续工作就像它应该工作。为什么需要这些导入?
I got the app working. But when I comment the imports out, the app keeps working like it should work. Why are these imports needed?
我仍在使用常规的Javascript,而不是ES6。
I am still using the regular Javascript, not ES6.
谢谢! / p>
Thanks!
推荐答案
import语句用于导入从外部模块导出的功能,对象或图元,另一个脚本等。
The import statement is used to import functions, objects or primitives that have been exported from an external module, another script, etc.
name参数是将接收导出成员的对象的名称。成员参数指定单个成员,而name参数导入所有成员。如果模块导出一个默认参数而不是一系列成员,则name也可能是一个函数。以下是澄清语法的示例。
The name parameter is the name of the object that will receive the exported members. The member parameters specify individual members, while the name parameter imports all of them. name may also be a function if the module exports a single default parameter rather than a series of members. Below are examples to clarify the syntax.
导入整个模块的内容。这将myModule插入到当前作用域中,其中包含来自my-module.js的所有导出的绑定。
Import an entire module's contents. This inserts myModule into the current scope, containing all the exported bindings from "my-module.js".
有关可以使用导入的不同方法的更多详细信息使用情况请查看。
For more detail about the different ways we can use import along with their usage, please check this.
这篇关于为什么在Meteor中需要打包进口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!