|
需要动态生成图像上传组件,仿照示例生成未能成功,请问该如何操作?- var cfg4 = {
- parentNode: this.getElementByXid('div1'),
- xid : "attachmentSimple1",
- "actionUrl" : "/baas/es/esService/SimpleFileStore",
- "bind-ref" : "$model.data1.ref("img")" ,
- "accept" : "image/*" ,
- "template" : " <div class='x-attachment' xid='div'> "
- + "<div class='x-attachment-content x-card-border' xid='div4'> "
- + " <div class='x-doc-process' xid='div5'> "
- + " <div class='progress-bar x-doc-process-bar' role='progressbar' style='width:0%;' xid='progressBar1'/></div> "
- + " <div data-bind='foreach:$attachmentItems' xid='div6'> "
- + " <div class='x-attachment-cell' xid='div7'> "
- + " <div class='x-attachment-item x-item-other' "
- + " data-bind='click:$model.previewOrRemoveItem.bind($model),style:{backgroundImage:($model.previewPicture.bind($model,$object))()}' xid='div8'>"
- + " <a data-bind="visible:$model.$state.get() == 'remove'" class='x-remove-barget' xid='a1'/>"
- + " </div> "
- + " </div> "
- + " </div> "
- + " <div class='x-attachment-cell' data-bind="visible:$state.get() == 'upload'" xid="div9"> "
- + " <div class="x-attachment-item x-item-upload" data-bind="visible:$state.get() == 'upload'" xid="div10"/> "
- + " </div> "
- + " <div class="x-attachment-cell" data-bind="visible:$state.get() == 'upload' && $attachmentItems.get().length > 0" xid="div11"> "
- + " <div class="x-attachment-item x-item-remove" data-bind="click:changeState.bind($object,'remove')" xid="div12"/> "
- + " </div>"
- + " <div style="clear:both;" xid="div13"/></div>"
- + " </div> "
- + " </div>"
- };
-
- new attachmentSimple(cfg4);
复制代码
上面的代码,是根据窗口手动生成得到的源码上调整而来,但生成不能成功,还请指导一下。谢谢!
|
|