// 判断原来的数据是否为空
var newTagArr = row.attr_vals ? row.attr_vals.split(',') : []
// 把原来的数组内容与新的内容合并为一个新数组 并转为字符串
const newTagStr = [...newTagArr, this.inputValue].join(',')
// 判断输入框是否有值 有值就发送请求
if (!this.inputValue) {
} else {
// 获取表单数据
// 发送请求
const res = await updateParams({
id: this.value[this.value.length - 1],
attrId: row.attr_id,
attr_name: row.attr_name,
attr_vals: this.inputValue,
attr_sel: this.tabValue
})
console.log(res)
// 新形成的tag标签
row.attr_vals = newTagStr
console.log(row.attr_vals, newTagStr)
}
// 输入框再隐藏
this.inputVisible = false
// 清空输入框数据
this.inputValue = ''
添加动态参数和静态属性tag标签
最新推荐文章于 2023-04-11 21:22:05 发布