js 更改对象中的属性名

const json = JSON.parse(JSON.stringify(options).replace(/name/g,"label"));

注:

  1、options是需要更改属性的对象

  2、replace(/name/g,"label")  ,将对象里所有属性为name的都修改成label

posted @ 2018-09-03 15:46  小欣子  阅读(14426)  评论(0编辑  收藏  举报