【问题标题】:Filepicker modal only displayed after initial page load in meteor文件选择器模式仅在流星中初始页面加载后显示
【发布时间】:2013-12-11 08:02:09
【问题描述】:

当我在模板中第一次调用 filepicker.pickAndStore() 时,一切正常。关闭模态并再次单击按钮也可以正常工作(再次显示模态)。当我单击我的流星应用程序中的链接以进入另一个页面时(当然通过像每个流星页面上的 html5 pushstate,没有标准的带有真实页面刷新的链接),然后返回到包含文件选择器内容的页面,按钮不再执行任何操作。不显示文件选择器模式或任何内容。而且我还尝试了文档中给出的回调函数。我在下面描述我的代码

Template.content.events({
   'click #top_add_file': function (evt) {
    evt.preventDefault();
    console.log("upload file button is clicked")
    Session.set("widgetSet", false);

    if (!Session.get("widgetSet")) {  
  var cb = function () {
    filepicker.pickAndStore(
        {
            mimetypes: ['application/pdf', 'application/msword',     'application/mspowerpoint', 'text/plain'],
            container: 'window',
            services: ['COMPUTER'],
            folders: true
        },
        {
            location: 'S3'
        },
        function (InkBlob) {
            console.log("InkBlob="+InkBlob)
            InkBlob.forEach(function (ib) {
                Meteor.call("createContent", ib, Meteor.content_file, function (error, result) {
                    if (error) {
                        FlashMessages.sendError("Error in saving file")
                    } else {
                        FlashMessages.sendSuccess("Successfully Saved File")
                    }

                })
            })
        },
        function (FPError) {

            FlashMessages.sendError("Error in uploading file. Please try again")

        }

     )
  };
  loadPicker(Meteor.fpkey, cb);
}


},

【问题讨论】:

  • 返回相关页面时浏览器控制台是否出现错误?

标签: javascript jquery meteor filepicker.io meteorite


【解决方案1】:

这个 StackOverflow 问题的答案可能会有所帮助: Integrating Filepicker.IO with Meteor

其中一个突出了文件选择器的氛围包: https://github.com/guido4000/loadpicker

此外,此示例显示了将第 3 方模态组件集成到流星中: https://github.com/alanning/meteor-modal-example

【讨论】:

    猜你喜欢
    • 2015-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-07
    • 1970-01-01
    • 1970-01-01
    • 2019-08-06
    • 1970-01-01
    相关资源
    最近更新 更多