js only copies the value of an object, not a reference

First the object into json, then the object can be parsed into

cloneObjectFn(obj) { // 对象复制
                return JSON.parse(JSON.stringify(obj))
            },

Guess you like

Origin www.cnblogs.com/yloved/p/12629463.html