HTML :
<label for="pays">Pays</label>
<lightning-output-field
field-name="Country__c" variant="label-hidden" id="pays"
></lightning-output-field> </br>
<lightning-layout-item class="slds-p-left_x-small">
<lightning-card variant="Narrow" title="Addresse" icon-name="standard:location">
<lightning-map map-markers={mapMarkers} list-view="hidden"></lightning-map>
</lightning-card>
JS :
@track mapMarkers = [];
@wire(getRecord, {
recordId: '$recordId',
fields: [ COUNTRY_FIELD, CITY_FIELD ]
},getRecentModifiedContacts)
fetchAcc({ data, error }) {
if (data) {
this.mapMarkers = [
{
location: {
City: data.fields.City__c.value,
Country: data.fields.Country__c.value,
},
}
];
console.log('this.mapMarkers => ', JSON.stringify(this.mapMarkers));
} else if (error) {
console.error('ERROR => ', error);
}