码迷,mamicode.com
首页 > 其他好文 > 详细

各种foreach

时间:2017-10-08 19:02:32      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:分享   rcp   rgb   script   close   his   flow   void   load   

技术分享
##                                        #if(${item.pic})
##                                            #foreach($picUrl in ${item.pic.split("\|")})
##                                            <div id="picPanel_${item.type}" picPanel="${item.name}" data-init="${picUrl}" data-name="${item.name}" data-inputName="pic"  data-inputId="pic_${item.type}"></div>
##                                            #end
##                                        #end
vm
技术分享
var showImgTemplateStr = ‘<div>            ${temp_name}:    {{if temp_srcArray}}    <div>         <ul>            {{each temp_srcArray}}                <li style="width: 20%;height: 5%;">                    <a href="javascript:void(0)" class="thumbnail">                    <img src="${$value}"">                    </a>                </li>            {{/each}}        </ul>    </div>    <div> </div>    {{/if}}        </div>‘;

function showPic(name,panelId, showUrl, ossDownloadUrl, value) {
    debugger;
    var src = null;
    var arraySrc=new Array();
    if (value && value.length > 0) {
        var arraySrcPart=value.split("|");
        if(arraySrcPart && arraySrcPart.length>0){
            for(var i=0;i<arraySrcPart.length;i++){
                src=null;
                if(arraySrcPart[i].indexOf("pop") == 0){
                    src = ossDownloadUrl + arraySrcPart[i]
                }else{
                    src = showUrl + arraySrcPart[i]
                }
                arraySrc.push(src);
            }
        }
    }
    $.tmpl(showImgTemplateStr, {
        temp_name : name,
        temp_srcArray : arraySrc
    }).appendTo("#" + panelId);
};
$.tmpl

 

技术分享
var template_chm = ‘<div>            ${temp_name}    {{if temp_srcArray}}    <div>      <ul>        {{each temp_srcArray}}            <li title="${temp_input_id}" style="width: 20%;height: 5%;">                <a href="javascript:void(0)" class="thumbnail">                    <img src="${$value.srcAll}"/>                </a>                <a id="chm1" href="javascript:void(0)" title="${$value.srcPart}" onclick="javascript:deleteCurrentImage(this);">删除</a>             </li>        {{/each}}    </ul>    </div>    <br/>    <div>     重新上传</div>    {{/if}}        </div>        <div class="upLoadbox img-info">            <div id="${temp_input_id}Div" class="webuploader-container"><div class="webuploader-pick">点击选择图片</div>                <div style="position: absolute; top: 5px; left: 10px; width: 100px; height: 100px; overflow: hidden; bottom: auto; right: auto;">                    <input type="file" name="file" class="webuploader-element-invisible" multiple="multiple" accept="image/jpeg,image/jpg,image/png" maxlength="100">                    <label style="opacity: 0; width: 100%; height: 100%; display: block; cursor: pointer; background: rgb(255, 255, 255);"></label>                </div>            </div>            <div class="diyButton" style="margin-top: 10px;  display: none;">            <input type="hidden" name="${temp_input_name}" id="${temp_input_id}" value="${temp_input_value}" required>            </div>        </div>‘;
function bindWfs(name, inputName,inputId, pandelId, showUrl, ossDownloadUrl, value,limit) {
    var src = null;
    var arraySrc=new Array();
    if (value && value.length > 0) {
        var arraySrcPart=value.split("|");
        for(var i=0;i<arraySrcPart.length;i++){
            var currentSrcPart=arraySrcPart[i];
            var currentSrcAll="";
            if(currentSrcPart.indexOf("pop") == 0){
                currentSrcAll = ossDownloadUrl + currentSrcPart;
            }else{
                currentSrcAll = showUrl + currentSrcPart;
            }
            var objSrc=new Object();
            objSrc.srcPart=currentSrcPart;
            objSrc.srcAll=currentSrcAll;
            arraySrc.push(objSrc);
        }
    }
    $.tmpl(template_chm, {
        temp_name : name,
        temp_input_name : inputName,
        temp_input_id : inputId,
        temp_input_value : value,
        temp_srcArray:arraySrc
    }).appendTo("#" + pandelId);
$.tmpl 对象

 

各种foreach

标签:分享   rcp   rgb   script   close   his   flow   void   load   

原文地址:http://www.cnblogs.com/caohuimingfa/p/7638124.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!