gpt4 book ai didi

javascript - ES6 导入/导出不适用于变量? meteor

转载 作者:行者123 更新时间:2023-11-30 15:14:04 25 4
gpt4 key购买 nike

为什么会这样

export var Tasks = new Mongo.Collection('tasks');

但这不是吗?

var Tasks = new Mongo.Collection('tasks');
export Tasks

最佳答案

因为这不是导出变量的标准方式。检查documentation :

export { name1, name2, …, nameN };
export { variable1 as name1, variable2 as name2, …, nameN };
export let name1, name2, …, nameN; // also var
export let name1 = …, name2 = …, …, nameN; // also var, const

export default expression;
export default function (…) { … } // also class, function*
export default function name1(…) { … } // also class, function*
export { name1 as default, … };

export * from …;
export { name1, name2, …, nameN } from …;
export { import1 as name1, import2 as name2, …, nameN } from …;

那么你能做的就是

export { Tasks };

关于javascript - ES6 导入/导出不适用于变量? meteor ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44720493/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com