[Vuejs]-Push unique key and value into array in Vue

2👍

Just a simple : this.inputFields[key] = value; should work fine.

2👍

You could use [] to wrap the computed key :

for (const [key, value] of Object.entries(check)) {
          console.log(`${key}: ${value}`);
          this.inputFields.push({
              [key]:value
          })
        }

Leave a comment