Array particular location the splice is inserted at the current value

Inserting an array of objects which values

   condition: [{
        settingValue: '',
         }],
  addCondition(rowIndex) {
                this.condition.splice(rowIndex+1,0, {})
                //我这里是通过获取点击当前行的索引rowIndex来实行的
            },

Key : ----- splice splice (index, NUM (0), Item)
index ------ you want to insert the index position
num ------- to zero, if not zero will replace the current index value
item ------- element to be inserted
, such as: a = [1, 2,4]
a.splice (2,0,3) => a = [1,2,3,4]

Guess you like

Origin blog.csdn.net/weixin_43565820/article/details/90374686