Javascript – Problem beim Aufrufen einer JS-Methode
淡淡烟草味
淡淡烟草味 2017-06-05 11:10:19
0
1
751

T1 ruft anPoint1 auf, warum wird function(_e){} als zweiter Parameter verwendet und wird der _e-Parameter verwendet, um Rückgaben zu empfangen oder Werte zuzuweisen?

 var T1=function(e,t,src,target,top,left,width,background){
          
        anPoint1(e,function(_e) {

            o[t] = _e[0];
            if (t == "logoimg") {
                var _slk = function(_oa){
                    if(_oa==true){
                        _sta[t] = true;
                    }else{
                        var h = B(); //var B
                        o.logoheight=h.height;
                        o.logowidth=h.width;
                        o.logoleft=h.left;
                        o.logotop=h.top;
                    }
                };
                if(e!=null){
                    _slk();
                    N();//var N
                }else{
                    var _timeout = null;
                    _slk(true);
                }
            }else if(e!=null||background){
                u.drawImage()
            }else{
                _sta[t] = true;
            }
            imgReso[t] = 'url:'+src;
        },src,target,t,top,left,width,background);
    }  
########################################################################################

var anPoint1 = function(e, t,src,target,d,top,left,width,background) {
        if (e) {
            function r() {
                var s = new Image;
                s.src = src;
                if (target) {
                    target.attr('src',src)
                }
                n.push(s);//把logo的img对象传入n数组,作为logo参数 在画布中画出
                t(n);
            }
        }
        else{
            function r(){
                var s1=new Image;
                s1.src=src;
                if (target) {
                    target.attr('src',src)
                }
                s1.onload=function(){
                    n.push(s1);//把logo的img对象传入n数组,作为logo参数 在画布中画出
                    if (d=='background') {
                        var w=s1.width,
                            h=s1.height,
                            bl=h/w;
                        if (Math.max(w,h)<o.maxwidth) {
                            if (w>=h) {
                                o.bgwidth=w;
                                v=o.bgwidth;
                                o.max=o.maxwidth;
                            }
                            else{
                                o.bgwidth=h;
                                v=o.bgwidth;
                                o.max=o.maxwidth*bl;
                            }
                        }
                        else  {
                            if (w>=h) {
                                o.bgwidth=o.maxwidth;
                                v=o.bgwidth;
                                o.max=o.maxwidth
                            }
                            else{
                                o.max=o.maxwidth*bl;
                                o.bgwidth=o.maxwidth*bl;
                                v=o.bgwidth;
                            }
                        }
                        ewmcsh = true;
                            var ewmtop = o.ewmtop;
                            var ewmleft = o.ewmleft;
                            o.ewmleft = parseInt(left) * o.bgwidth / 270 || o.ewmleft;
                            o.ewmtop = parseInt(top) * o.bgwidth / 270 || o.ewmtop;
                            var ewmdjw = o.width;
                            o.width = parseInt(width) * o.bgwidth / 270 || o.width;
                            bl1 = (o.width-o.margin*2)/ o.bgwidth;
                            bl2 = (o.ewmtop+o.margin) / o.bgwidth;
                            bl3 = (o.ewmleft+o.margin) / o.bgwidth;
                            if (top != 0 && left != 0 && width != '') {
                                ewmcsh = false;
                                if (background) {
                                    o.bgColor = o.bgColor == 'rgba(225,225,225,0)' ? background : o.bgColor;
                                    $('#resetBgColor').css('display', 'block');
                                }
                                var logowbl = o.logowidth / ewmdjw;
                                var logohbl = o.logoheight / ewmdjw;
                                var logotopbl = (o.logotop  - ewmtop) / ewmdjw;
                                var logoleftbl = (o.logoleft  - ewmleft) / ewmdjw;
                                o.logowidth = o.width * logowbl;
                                o.logoheight = o.width * logohbl;
                                o.logotop = o.width * logotopbl + o.ewmtop;
                                o.logoleft = o.width * logoleftbl + o.ewmleft;
                                logozdz();
                            }
                            $('#qrcode_size').val(o.bgwidth);
                            $('#qrcode_size1').val(o.bgwidth);
                            //slidersize.setvalue(o.bgwidth);
                    }
                    t(n);
                }
            }
        }
        t = t || S;
        var n = [];
        r();
    };



淡淡烟草味
淡淡烟草味

Antworte allen(1)
Peter_Zhu

因为第二个参数的参数类型就是一个函数,参数类型不一定只有字符串 数字或者布尔类型的,把函数当参数传递你没用过么?_e是传递过去的这个函数自己的参数 你就把它当成一个函数去理解就ok了 就像是简单的
function(a){ alert(a) }; 这个_e跟a没什么区别

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage