function(buttons){
        var buttonContainer = this.el.find('.as-buttons');

        // 清空按钮容器
        buttonContainer.html('');

        // 添加取消按钮
        buttons['取消'] = this.hide.bind(this);
        
        // 遍历创建按钮
        Object.keys(buttons).forEach(function(key){
            var n = buttons[key],
                btn = $($.tpl(buttonTpl, {
                    text: key
                }));

            // 绑定tap事件
            bindTapEvent(btn[0], function(e){

                e.stopPropagation();
                e.preventDefault();
                
                // 如果参数是函数则调用
                // 如果是字符串则认为是url直接跳转
                if(typeof this.action === 'function'){
                    this.action.call(this.context, e);
                }else if(typeof this.action === 'string'){
                    location.href = this.action;
                };
            }.bind({action: n, context: this}));

            // 触摸反馈
            btn.on('touchstart', function(e){
                $(e.target).addClass('as-active');
            }).on('touchend', function(e){
                $(e.target).removeClass('as-active');
            });

            // 添加到按钮容器
            buttonContainer.append(btn);
        }.bind(this));

        return this;
    }
function(buttons){
        var buttonContainer = this.el.find('.as-buttons');

        
        buttonContainer.html('');

        
        buttons['取消'] = this.hide.bind(this);
        
        
        Object.keys(buttons).forEach(function(key){
            var n = buttons[key],
                btn = $($.tpl(buttonTpl, {
                    text: key
                }));

            
            bindTapEvent(btn[0], function(e){

                e.stopPropagation();
                e.preventDefault();
                
                
                
                if(typeof this.action === 'function'){
                    this.action.call(this.context, e);
                }else if(typeof this.action === 'string'){
                    location.href = this.action;
                };
            }.bind({action: n, context: this}));

            
            btn.on('touchstart', function(e){
                $(e.target).addClass('as-active');
            }).on('touchend', function(e){
                $(e.target).removeClass('as-active');
            });

            
            buttonContainer.append(btn);
        }.bind(this));

        return this;
    }
function ( buttons ) { var buttonContainer = this . el . find ( '.as-buttons' ) ; // 清空按钮容器 buttonContainer . html ( '' ) ; // 添加取消按钮 buttons [ '取消'] =  t i .hid e .bin d (thi s ); // 遍历创建按钮 Object . keys ( buttons ) . forEach ( function ( key ) { var n = buttons [ key ] , btn = $ ( $ . tpl ( buttonTpl , { text : key } ) ) ; // 绑定tap事件 bindTapEvent ( btn [ 0 ] , function ( e ) { e . stopPropagation ( ) ; e . preventDefault ( ) ; // 如果参数是函数则调用 // 如果是字符串则认为是url直接跳转 if ( typeof this . action === 'function' ) { this . action . call ( this . context , e ) ; } else if ( typeof this . action === 'string' ) { location . href = this . action ; } ; } . bind ( { action : n , context : this } ) ) ; // 触摸反馈 btn . on ( 'touchstart' , function ( e ) { $ ( e . target ) . addClass ( 'as-active' ) ; } ) . on ( 'touchend' , function ( e ) { $ ( e . target ) . removeClass ( 'as-active' ) ; } ) ; // 添加到按钮容器 buttonContainer . append ( btn ) ; } . bind ( this ) ) ; return this ; }
更新按钮
更新按钮