初学者在这里
在用户输入城市名称后,我试图用经/纬度信息自动填充GeoPoint字段。我的模型如下所示:
Location.add({
title: { label: 'Location name', type: String, required: true },
content: {
product: { label: 'Product', type: Types.Select, options: 'Option1, Option2', default: 'Option1', index: true, required: true },
address: { label: 'Address', type: String, required: true, initial: false },
state: { label: 'State', type: Types.Select, options: usStates, index: true, required: true, initial: false},
city: { label: 'City', type: String, required: true, initial: false},
country: { label: 'Country', type: Types.Select, options: 'USA', default: 'USA', index: true },
latlng: { label: 'GEO Location', type: Types.GeoPoint, enableMapsAPI: true, **watch: 'city', value: getGEO**},
cloudinaryImages: { label: 'Location images', type: Types.CloudinaryImages },
},});
我这样声明了我的getGEO函数(现在什么也没有发生):
function getGEO() {
console.log('HELLO WORLD...')
}
但是,当我提交生成的表单时,不会调用getGEO函数。需要帮助解决此问题。除此之外:
谢谢。