未捕获的错误:找不到ID为'qq-template'的模板脚本! [英] Uncaught Error: Cannot find template script at ID 'qq-template'!

查看:71
本文介绍了未捕获的错误:找不到ID为'qq-template'的模板脚本!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚下载了适用于Fine Uploader 4.0的新自定义版本".我的页面在几周前安装并设置的3.9上运行良好.

I just downloaded my new "custom build" for Fine Uploader 4.0. My page was working fine on 3.9 which I installed and setup a few weeks ago.

我的代码:

Click "Select Files" and pick the files you would like to upload.  Then click "Upload Now" to start the transfer.
<hr>
<div id="fineuploader-s3"></div>
<div id="triggerUpload" class="btn btn-primary" style="margin-top: 10px;">
    <i class="icon-upload icon-white"></i> Upload now
</div>

    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script src="http://xxxxxxx/fineuploader-4.0.3/custom.fineuploader-4.0.3.js"></script>
    <script>


      $(document).ready(function () {

          var manualuploader;

          function check_done() {
              if (allUploadsCompleted() === true) {
                  var successUrl = "http://xxxxxxxx/FineUploadComplete?ftpSessionId=xxxxxx";
                  $.get( successUrl );
                  alert('Your upload is complete.');
                  window.top.location = "xxxxxxxx";
              } 
           }

           function allUploadsCompleted() {
               // If and only if all of Fine Uploader's uploads are in a state of completion will this function fire the provided callback.
               var inProgress = manualuploader.fineUploader('getInProgress');
               if (inProgress === 0) {
                   var failedUploads = manualuploader.fineUploader('getUploads', { status: qq.status.UPLOAD_FAILED });
                   if (failedUploads.length === 0) {
                       return true;
                   }
                }        
                return false;
            }


            manualuploader = $('#fineuploader-s3').fineUploaderS3({
                debug: true,
            autoUpload: false,
                editFilename: {
                enabled: true
            },
            element: $('#fineuploader-s3')[0],
            text: {
                uploadButton: '<i class="icon-plus icon-white"></i> Select Files'
                },
                cors: {
                       expected: true,
                       sendCredentials: true
                },
                request: {
                    endpoint: "xxxxx",
                    accessKey: "xxxx"
                },
                signature: {
                    endpoint: "http://xxxxxx/S3UploadSig"
                },
        objectProperties: {
                key:  function (fileId) { return "xxxx" + '/' + $("#fineuploader-s3").fineUploader("getName",fileId); } 
            },
                retry: {
                        showButton: true
                },
                chunking: {
                        enabled: true
                },
                resume: {
                        enabled: true
                },
                deleteFile: {
                        enabled: false
                },
                callbacks: {
                    onStatusChange: function (id, oldStatus, newStatus) {
                        // This will check to see if a file that has been cancelled
                        // would equate to all uploads being 'completed'.
                        if (newStatus === qq.status.CANCELLED) {
                            check_done();
                        }     
                    },
                    onComplete: check_done
                },
                validation: {
            allowedExtensions: [xxxxxx]
                }
          });

    $('#triggerUpload').click(function() {
            manualuploader.fineUploader('uploadStoredFiles');
        });

      });
    </script>

我在Java控制台中遇到以下错误...

I'm getting the following error in the java console...

未捕获的错误:找不到ID为"qq-template"的模板脚本!

@ custom.fineuploader-4.0.3.js:4915

@ custom.fineuploader-4.0.3.js:4915

那么我该如何解决此错误,还需要在4.0上进行其他更改?

So how do I get around this error and are there other changes I need to make to work on 4.0?

谢谢, J

推荐答案

Fine Uploader 4.0在模板化方面带来了很大的改进.这需要进行重大更改,因此主要版本号已增加.

Fine Uploader 4.0 brought about a big improvement in templating. This required breaking changes, thus the major version number was incremented.

简而言之,templatefileTemplate选项已从JavaScript文件中移出.现在,您必须在文档/标记中定义模板.这具有许多优点.最大的优点是,这使得自定义Fine Uploader UI模板更加直观.默认模板随构建一起提供.您可以在样式指南中阅读有关模板的更多信息,以及4.0中的所有其他重大更改.在升级到4.x"指南中.

In short, the template and fileTemplate options were moved out of the JavaScript file. You must now define your template in your document/markup. This has a number of advantages. The biggest being that this makes it much more intuitive to customize the Fine Uploader UI template. Default templates are provided with the build. You can read more about templating in the styling guide, along with all other breaking changes in 4.0 in the "Upgrading to 4.x" guide.

请注意,fileTemplate选项已删除.默认情况下,template选项现在指向包含模板的元素.默认情况下,它期望此元素的ID为"qq-template".您可以覆盖它并传递实际元素或其他ID.模板通常包含在<script>标记中,带有type,但这不是必需的.

Note that the fileTemplate option was removed. The template option now, by default, points to an element that contains your template. By default, it expects this element to have an ID of "qq-template". You can override this and pass an actual element or a different ID. It's common for your template to be contained in a <script> tag w/ a type of "text/template", but this is not required.

这篇关于未捕获的错误:找不到ID为'qq-template'的模板脚本!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆