【发布时间】:2018-07-19 12:33:03
【问题描述】:
我有一个计算方法可以让我显示一些数据:
productsSpecification() {
var names = [];
var numbers = [];
this.cart.items.forEach(function(item) {
names += "Item: " + item.product.name + " -";
numbers += " Amount: " + item.quantity + ", ";
});
var together = names + numbers;
return together;
}
我想按顺序显示元素:'names' 数组中的元素 + 'numbers' 数组中的元素:'Item: item1 - Amount: 1'。
【问题讨论】:
-
你会使用 ES6 吗?
-
是的,我用的是webpack,但是问题已经解决了。
标签: javascript vue.js computed-properties