vue Js对象结构函数使用方法

yuanyuanyang / 2023-05-26 / 原文

写了三行不如一行搞定

原先的

 const inComeTypeId = this.queryForm.inComeTypeId
 const currentPage = this.queryForm.currentPage
 const pageSize = this.queryForm.pageSize

现在的

const { inComeTypeId, currentPage, pageSize } = this.queryForm

一行代码实现变量命名及从对象中取值,比较的爽哈。