在这里,this.DATA里面还有其他字段。this.connection就只有这些字段。不想直接this.connection = this.DATA这样赋值。只想key值一样的赋值。但是下面写的可以简单优化一下吗?
const { name, type } = this.DATA this.connection = { name, type }
Object.assign(connection,DATA)