Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
287 views
in Technique[技术] by (71.8m points)

Reflect 定义属性后 传给后台属性丢失的问题

代码

Reflect.defineProperty(params, "tenantId",{value:this.$mes_tid});
Reflect.defineProperty(params, "orgId",{value:this.$mes_oid});

我在本地打印如下(疑惑tenantId 和 orgId字段颜色有点透明度)
image.png

network 显示的
image.png
发现少了 tenantId 和 orgId!
请大佬分析


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

defineProperty 建立的属性,[[Enumerable]] 默认时 false 。

根据你传的方式,可能枚举不出来

JSON.stringify 就不会打印 [[Enumerable]] 为 false 的属性。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...