JQuery Mobile .page()函数导致无限循环?

sw0*_*w00 4 javascript jquery dhtml jquery-mobile

我正在使用来自AJAX响应的数据动态创建列表视图.它成功创建了listview并填充它,但是当我在其上调用JQM的.page()函数时,它似乎进入了一个无限循环,其中listview被永久地附加.

这是JQM中的错误还是我做错了什么?

pageScript(function($context){
    $context.bind("pagecreate", function(event, ui){
        createMenu(); //function that deletes existing ul#menu and dynamically creates new one. 
        $('ul#menu').page(); //here's where it causes a problem
        $('#menu a').bind('click', function(){
            $.mobile.changePage($(this).attr("href"), {pageContainer: $("#primary-content"), transition: "fade", changeHash: false, reloadPage: true});
            return false;
        });
    });
});
Run Code Online (Sandbox Code Playgroud)

pageScript是一个允许我在JQM加载时运行页面级脚本的函数.它在基本模板或index.html中定义:

function pageScript(func) {
            var $context = $("div:jqmData(role='page'):last");
            func($context);
        };
Run Code Online (Sandbox Code Playgroud)

Joe*_*Joe 14

而不是.page()使用.trigger( "create" ); jQuery Mobile团队更新:7月18日周http://jquerymobile.com/blog/