【发布时间】:2019-10-11 15:45:24
【问题描述】:
出现错误“您可能在组件渲染函数中有无限更新循环。”完全不知道该怎么办?
我尝试将数组设为数据值。另外,我尝试过使用 for 循环。在第一种方法中似乎是孤立的。
data() {
return {
activeTab: 0,
uniqueLobs: []
}
},
methods: {
addDollarSymbol(val){
var newVal = "$" + val;
return newVal.replace(/<(?:.|\n)*?>/gm, ''); //trims white space
},
removeDuplicateLOB(lineOfBusiness) {
//removes duplicate LOBs for tabs
let incomingLobs = [];
lineOfBusiness.forEach((business) => {
incomingLobs.push(business.line_of_business.name);
});
this.uniqueLobs = [...new Set(incomingLobs)];
return this.uniqueLobs;
},
showSpecificLobData(activeTab){
//compares tab LOB to all incoming card data and shows only the LOB data for that specific tab
let activeTabData = [];
this.product_rate_card.forEach((product) => {
if (product.line_of_business.name == this.uniqueLobs[activeTab] ) {
activeTabData.push(product);
}
});
return activeTabData;
}
}
【问题讨论】:
-
你能把你所有的代码贴在
script标签里
标签: vue.js