可能这是一个noobisch问题。目前我正在摆弄 Framer.js。我有一个 CoffeeScript 问题;
types = ["orange", "apple", "banana", "grapefruit", "pear"]
for i in types
li = new TextLayer
text: types
y: li * 60
li.parent = dropdownList
print "list-item-" + "#{i}", i
所以我有一个数组,我想向一个对象实例声明一个动态变量。上面的代码只生成 5 个 li 层(这是 Framer 特定的 > 我不想在编辑器中使用非自我解释的层名称)
所以在for循环中;
var item-orange = 新层...
var item-apple = new Layer... 等等
我怎么能用 CoffeeScript 完成这个?