【问题标题】:Meteor/Autoform-maps/Google-maps package error?Meteor/Autoform-maps/Google-maps 包错误?
【发布时间】:2015-07-05 08:26:53
【问题描述】:

我在我的应用程序中同时使用了 yogiben:autoform-map 和 dburles:google-maps 包。看来他们不能很好地协同工作。使用 dburles:google-maps 的代码工作正常,但自动生成地图抛出此错误:

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-maps 包之前,此自动表单运行良好。在 autoform-map.coffee 中调用此代码时,似乎“GoogleMaps”还没有准备好

    GoogleMaps.init { libraries: 'places' }, () =>
    mapOptions =
        zoom: 0
        mapTypeId: google.maps.MapTypeId[@data.options.mapType]
        streetViewControl: false

这看起来很奇怪,因为我已经在做流星启动:

Meteor.startup(function() {
    if (GoogleMaps.loaded()?false:true) {
        GoogleMaps.load();
    }

});

【问题讨论】:

    标签: google-maps meteor meteor-autoform


    【解决方案1】:

    正如 yogiben 所说,这两个包之间存在冲突:https://github.com/yogiben/meteor-autoform-map/issues/9

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-02
    • 2017-10-05
    • 1970-01-01
    • 1970-01-01
    • 2016-08-14
    • 2016-09-16
    • 2020-09-06
    相关资源
    最近更新 更多