我在应用程序中同时使用了yogiben:autoform-map和dburles:google-map包。它们似乎不能很好地协同工作。使用dburles的代码:google- map运行良好,但是autoform map抛出了这个错误:
Exception from Tracker afterFlush function:
TypeError: undefined is not a function
at t.afMap.rendered (d56467d85b9f586916cc49f2dba3c180bfed1ddc.js:210)
at p (d56467d85b9f586916cc49f2dba3c180bfed1ddc.js:154)
at a (d56467d85b9f586916cc49f2dba3c180bfed1ddc.js:154)
at d56467d85b9f586916cc49f2dba3c180bfed1ddc.js:66
at Function.e._withTemplateInstanceFunc (d56467d85b9f586916cc49f2dba3c180bfed1ddc.js:66)
at n (d56467d85b9f586916cc49f2dba3c180bfed1ddc.js:66)
at null.<anonymous> (d56467d85b9f586916cc49f2dba3c180bfed1ddc.js:66)
at d56467d85b9f586916cc49f2dba3c180bfed1ddc.js:65
at Object.c._withCurrentView (d56467d85b9f586916cc49f2dba3c180bfed1ddc.js:65)
at d56467d85b9f586916cc49f2dba3c180bfed1ddc.js:65我的html:
{{#autoForm class="add" id="add" collection="ServiceProviders" type="insert"}}
{{> afQuickField name="businessname"}}
{{> afQuickField name="officelocation"}}
<button type="submit" class="btn">Create!</button>
{{/autoForm}}我的收藏:
officelocation: {
type: String,
label: 'Location of Office',
autoform: {
type: 'map',
afFieldInput: {
type: 'map',
geolocation: true,
searchBox: true,
autolocate: true
}
} }此外,在我添加dburles:google-map包之前,这个自动表单运行得很好。在autoform-map.cafee中调用此代码时,"GoogleMaps“似乎还没有准备好。
GoogleMaps.init { libraries: 'places' }, () =>
mapOptions =
zoom: 0
mapTypeId: google.maps.MapTypeId[@data.options.mapType]
streetViewControl: false这看起来很奇怪,因为我已经在meteor startup上做了:
Meteor.startup(function() {
if (GoogleMaps.loaded()?false:true) {
GoogleMaps.load();
}});
发布于 2015-04-27 20:39:22
正如yogiben在这里指出的那样,这两个包之间存在冲突:https://github.com/yogiben/meteor-autoform-map/issues/9
https://stackoverflow.com/questions/29886354
复制相似问题