跳到主要内容

Location

位置字段使用 dataType: 'object'。它以结构化值存储地址和坐标信息。

常见位置属性包括地址文本、国家、省/州、城市、区县、街道、邮编、兴趣点和坐标。实际包含哪些属性取决于地图服务商和字段配置。

const rawLocation = record.data.delivery_location;
const location =
rawLocation && typeof rawLocation === 'object' && !Array.isArray(rawLocation)
? rawLocation as Record<string, unknown>
: {};

const city = String(location.city || '');
const address = String(location.address || '');

脚本需要判断哪些位置部分为必填时,可以通过 context.formSchema.field 读取字段配置。