当我在Web应用程序中加载JqueryMobile时,立即收到此错误,但是我不明白为什么会出现此问题。你能指出我正确的方向吗?谢谢!


Uncaught TypeError: Object function ( name, base, prototype ) {
        var namespace = name.split( "." )[ 0 ],
            fullName;
        name = name.split( "." )[ 1 ];
        fullName = namespace + "-" + name;

        if ( !prototype ) {
            prototype = base;
            base = $.Widget;
        }

        // create selector for plugin
        $.expr[ ":" ][ fullName ] = function( elem ) {
            return !!$.data( elem, name );
        };

        $[ namespace ] = $[ namespace ] || {};
        $[ namespace ][ name ] = function( options, element ) {
            // allow instantiation without initializing for simple inheritance
            if ( arguments.length ) {
                this._createWidget( options, element );
            }
        };

        var basePrototype = new base();
        // we need to make the options hash a property directly on the new instance
        // otherwise we'll modify the options hash on the prototype that we're
        // inheriting from
    //  $.each( basePrototype, function( key, val ) {
    //      if ( $.isPlainObject(val) ) {
    //          basePrototype[ key ] = $.extend( {}, val );
    //      }
    //  });
        basePrototype.options = $.extend( true, {}, basePrototype.options );
        $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
            namespace: namespace,
            widgetName: name,
            widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
            widgetBaseClass: fullName
        }, prototype );

        $.widget.bridge( name, $[ namespace ][ name ] );
    } has no method 'extend' jquery.mobile-1.2.0.js:568
    $.Widget._createWidget jquery.mobile-1.2.0.js:568
    $.(anonymous function).(anonymous function) jquery.mobile-1.2.0.js:405
    (anonymous function) jquery.mobile-1.2.0.js:541
    jQuery.extend.each jquery-1.8.2.js:611
    jQuery.fn.jQuery.each jquery-1.8.2.js:241
    $.fn.(anonymous function) jquery.mobile-1.2.0.js:536
    (anonymous function) jquery.mobile-1.2.0.js:1091
    jQuery.event.dispatch jquery-1.8.2.js:3063
    elemData.handle.eventHandle jquery-1.8.2.js:2681
    jQuery.event.trigger jquery-1.8.2.js:2946
    (anonymous function) jquery-1.8.2.js:3604
    jQuery.extend.each jquery-1.8.2.js:611
    jQuery.fn.jQuery.each jquery-1.8.2.js:241
    jQuery.fn.extend.trigger jquery-1.8.2.js:3603
    $.extend.initializePage jquery.mobile-1.2.0.js:9082
    (anonymous function) jquery.mobile-1.2.0.js:9140
    fire jquery-1.8.2.js:974
    self.fireWith jquery-1.8.2.js:1082
    jQuery.extend.ready jquery-1.8.2.js:406
    DOMContentLoaded

最佳答案

我通过删除了jquery.ui.widget.js 来解决此问题,这可能是在遥远的过去所需要的,但现在不再需要。

关于javascript - 未捕获的TypeError:加载Jquery Mobile时的对象函数(名称,基于,原型(prototype)),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12757765/

10-11 15:48