嘿,我是meteor
的新手,目前正在尝试上传图片,我发现filepicker
。我在项目中使用了玉手把和coffeescript包。
这是代码
test.coffee
FILEPICKER_APIKEY = 'Ay67d74M9SgadSy6uXJyu6'
Meteor.startup ->
console.log 'test client'
filepicker.setKey FILEPICKER_APIKEY
#filepicker.constructWidget document.getElementById "upload_widget"
Template.hello.greeting = ->
"Hello World."
Template.hello.events
'click input' : ->
if console?
console.log "You pressed the button"
Template.upload.rendered = ->
filepicker.constructWidget this.find '#upload_widget'
Template.upload.events
'change #upload_widget': (evt) ->
if console?
console.log JSON.stringify(evt.fpfile)
这是test.jade代码
head
title helloworld
body
.container-fluid
.span6
{{> hello}}
.span6
{{> upload}}
template(name="hello")
#test
h1 Hello World!
{{greeting}}
input(type="button", value="Click")
template(name="upload")
input(type="filepicker", id="upload_widget")
现在这是我的问题:
似乎出现了两个filepick按钮。一个按钮工作正常,图像可以上传,当按下其他按钮时console
显示以下错误uncaught exception: FilepickerException: API Key not found
为什么第二个按钮出现?
请帮我删除第二个非功能按钮。
谢谢你提前!!