Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the method of assigning Object.assign ({}, row) to objects in vue

Shulou Source: shulou.com Published: 2022-06-01 10:03:21 10月03日 Update

This article mainly introduces the vue object assignment Object.assign ({}, row) way is what the relevant knowledge, the content is detailed and easy to understand, simple and fast operation, has a certain reference value, I believe you will get something after reading this vue object assignment Object.assign ({}, row) way article, let's take a look at it.

Object.assign ({}, row) assigned to the object

Copy function. If you want to remove id without passing it, set the local variable and assign the entire row object to the newData variable, using Object.assign ({}, row); use the delete method to delete id in newData

CopyStep (index,row) {/ / assign the object to a variable let newData = Object.assign ({}, row) delete newData.id passes the processed variable to the following two methods this.addStep (index,newData); this.showEditDialog (index + 1) newDataLines true);}, a small knowledge point that Object.assign () needs to pay attention to

What if the original object changes when object.assign () is used?

As shown in the figure, the original object obj will also change. If you do not want the original object obj to change, you can use the following method. If the first parameter passed in is empty, the original object will not change.

This is the end of the article on "how Object.assign ({}, row) objects are assigned in vue". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "what is the way of assigning Object.assign ({}, row) to objects in vue". If you want to learn more knowledge, welcome to follow the industry information channel.

Tags: Object mode variable knowledge method content article two value function parameter local how to do train of thought simple operation article easy to understand more see knowledge point Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB vpn OPPO Reno macOS Xiaomi