// 获取动态参数数据
if ((this.paramsObj.params === 'many')) {
this.manyData = res.data.data
// 遍历数组用map方法
const newArr = res.data.data.map((item) => {
return { attr_id: item.attr_id, attr_vals: item.attr_vals }
})
console.log(newArr, 4443)
// 合并拿到的数据
this.ruleForm.goods_attrs = [...this.ruleForm.goods_attrs, ...newArr]
}
// 切换的name值是2 就是动态参数
if (activeName === '2') {
this.paramsObj.params = 'many'
this.getData()
}
// 获取静态属性数据
if ((this.paramsObj.params === 'only')) {
this.onlyData = res.data.data
const newArr = res.data.data.map((item) => {
return { attr_id: item.attr_id, attr_vals: item.attr_vals }
})
console.log(newArr, 3335)
this.ruleForm.goods_attrs = [...this.ruleForm.goods_attrs, ...newArr]
console.log(this.ruleForm.goods_attrs, 6666)
alert(this.ruleForm.goods_attrs, 4412)
}
// 切换的name值是3 就是静态属性 获取静态属性数据
if (activeName === '3') {
this.paramsObj.params = 'only'
this.getData()
}