LWC 如何在闪电输入字段中显示地址值?

问题描述 投票:0回答:1

我有 changedFields 对象,其结构如下:

更改的字段:{"Name":"Test Practice Test","ReasonForUpdate":"Test","BillingAddress":{"BillingCity":"Beaumont","BillingCountry":"United States","BillingCountryCode":" US","BillingGeocodeAccuracy":null,"BillingLatitude":null,"BillingLongitude":null,"BillingPostalCode":"77705","BillingState":"TX","BillingStateCode":"TX","BillingStreet":"测试街变 123"}}

我想在闪电输入字段中显示 BillingAddress 值,但它是空的: Form

我尝试添加 {changedFields.BillingAddress} 作为闪电输入字段的值,我期望它将以以下形式显示: HTML code

我与名称具有相同的功能,其结构与地址类似,并且工作正常。 我怎样才能通过地址实现这一目标?我宁愿避免使用单独的字段或闪电输入地址,因为它需要重建很少的组件。

javascript html salesforce lwc
1个回答
0
投票

您可能正在设置changedFields类似的东西,对吗?

this.changedFields.BillingAddress = newValue;

这不会起作用,因为引用没有改变。你必须做这样的事情才能让用户界面做出反应:

this.changedFields = { ...this.changedFields, BillingAddress: newValue };
© www.soinside.com 2019 - 2024. All rights reserved.