Meteor 流星-卢克马德拉:自动形成谷歌广场
我已经安装了Meteor 流星-卢克马德拉:自动形成谷歌广场,meteor,Meteor,我已经安装了lukemadera:autoformgoogleplace软件包,并按照使用说明进行了操作。当我运行应用程序时,地址字段不会在我键入时自动填充。控制台中出现错误(模板助手中的异常:ReferenceError:EJSON未定义)有人能告诉我缺少什么吗 路径:Layout.html <head> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?librarie
lukemadera:autoformgoogleplace
软件包,并按照使用说明进行了操作。当我运行应用程序时,地址字段不会在我键入时自动填充。控制台中出现错误(模板助手中的异常:ReferenceError:EJSON未定义)
有人能告诉我缺少什么吗
路径:Layout.html
<head>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>
</head>
路径:personalDetails.js
Schema.Address = new SimpleSchema({
fullAddress: {
type: String
},
lat: {
type: Number,
decimal: true
},
lng: {
type: Number,
decimal: true
},
geometry: {
type: Object,
blackbox: true
},
placeId: {
type: String
},
street: {
type: String,
max: 100
},
city: {
type: String,
max: 50
},
state: {
type: String,
regEx: /^A[LKSZRAEP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY]$/
},
zip: {
type: String,
regEx: /^[0-9]{5}$/
},
country: {
type: String
}
});
Schema.UserProfile = new SimpleSchema({
address: {
type: Schema.Address,
optional: true
}
});
<template name="personalDetails">
{{#autoForm collection="Meteor.users" id="candidateProfile" doc=currentUser type="update"}}
{{> afQuickField name="profile.address" type="googleplace" opts=optsGoogleplace}}
{{/autoForm}}
</template>
Template.personalDetails.helpers({
optsGoogleplace: function() {
return {
// type: 'googleUI',
// stopTimeoutOnKeyup: false,
// googleOptions: {
// componentRestrictions: { country:'us' }
// }
}
}
});
仅供参考,以防其他人出现此错误,您需要安装。您是否尝试将
EJSON未定义
放入google以查看发生了什么?是的,但我找不到任何内容。在说明中没有提到任何关于设置json文件的内容。这可能是问题所在吗?不。这是因为你丢失了一个包裹。我所在的第一个谷歌搜索结果立即显示了解决方案MG,我确实读了那篇文章,我查看了meteor版本,看到了这篇ejson@1.0.7
。我认为这意味着它现在是流星的标准部分。无论如何,我已经添加了这个包,控制台日志错误消失了,自动表单工作了。你知道为什么会这样吗?再次感谢@ThaiTrani我不确定ejson
是否为默认值。但如果我看到这条信息,就意味着一个包裹可能丢失了