2

我在android上遇到了一个奇怪的错误,我有一个页面视图,它具有加载内容视图(FILTER)的侧视图(SIDE),而不是这个过滤器视图加载另一个视图(FORM),最后一个加载一些视图(文本)

[INFO] :   ADD :: TEXT
[INFO] :   ADD :: TEXT
[INFO] :   ADD :: FORM
[INFO] :   ADD :: FILTER
[INFO] :   ADD :: SIDE

当我关闭活动页面视图时,这会在子视图上调用清理功能:

$.page.cleanup = function() {
    side.cleanup();
};

console.log('ADD :: SIDE');
$.side.cleanup = function() {
    console.log('DESTROY :: SIDE');
    filter.cleanup();
    //remove listeners, and null objects
};

console.log('ADD :: FILTER');
$.filter.cleanup = function() {
    console.log('DESTROY :: FILTER');
    form.cleanup();
    //remove listeners, and null objects
};

console.log('ADD :: FORM');
$.form.cleanup = function() {
    console.log('DESTROY :: FORM');
    for(var i in text) text[i].cleanup();
    //remove listeners, and null objects
};

console.log('ADD :: TEXT');
$.text.cleanup = function() {
    console.log('DESTROY :: TEXT');
    //remove listeners, and null objects
};

但是当我在 android 中运行清理功能时,它会启动一个循环,在 iOS 上可以正常工作:

IOS:

[INFO] :   CLEANUP :: SIDE
[INFO] :   CLEANUP :: FILTER
[INFO] :   CLEANUP :: FORM
[INFO] :   CLEANUP :: TEXT
[INFO] :   CLEANUP :: TEXT

安卓:

[INFO] :   CLEANUP :: SIDE
[INFO] :   CLEANUP :: FILTER
[INFO] :   CLEANUP :: FORM
[INFO] :   CLEANUP :: TEXT
[INFO] :   CLEANUP :: TEXT
[INFO] :   CLEANUP :: FILTER
[INFO] :   CLEANUP :: FORM
[INFO] :   CLEANUP :: FILTER
[INFO] :   CLEANUP :: FORM
[INFO] :   CLEANUP :: FILTER
[INFO] :   CLEANUP :: FORM
[INFO] :   CLEANUP :: FILTER
[INFO] :   CLEANUP :: FORM
...

任何想法??

4

1 回答 1

1

错误地我以这种方式清理按钮:

for(var i in $.buttons) $.buttons[i].cleanup();

代替:

for(var i in $.buttons.children) $.buttons.children[i].cleanup();

不知道为什么,但这会在过滤器视图清理事件上创建一个循环,已解决,感谢您的回答

于 2016-02-05T11:18:19.817 回答