|
[App引擎]
navigationBar 与 frameGroup 重复调用的问题
[复制链接]
在做左右滑动功能的时候,
navigationBar: 点击时,切换到对应的 frame
- navigationBar.open({
- items : [{
- title : '新网页蚂蚁',
- bgSelected : 'rgba(217,223,229,0.5)'
- }, {
- title : '新网页蚂蚁',
- bgSelected : 'rgba(217,223,229,0.5)'
- }, {
- title : '新网页蚂蚁',
- bgSelected : 'rgba(217,223,229,0.5)'
- }]
- }, function(ret, err) {
- //设置 FrameGroupIndex
- api.setFrameGroupIndex({
- name : 'group',
- index : ret.index,
- scroll : false
- });
- });
复制代码
framegroup: 滑动后,同时切换对应的navigationBar item
- api.openFrameGroup({
- index : 0,
- preload : 0, //不设置预加载
- frames : [{
- name : 'list1',
- url : './list.html',
- pageParam : {
- p : 1
- },
- vScrollBarEnabled : true,
- hScrollBarEnabled : false
- }, {
- name : 'list2',
- url : './list.html',
- pageParam : {
- p : 2
- },
- vScrollBarEnabled : true,
- hScrollBarEnabled : false
- }, {
- name : 'list3',
- url : './list.html',
- pageParam : {
- p : 3
- },
- vScrollBarEnabled : true,
- hScrollBarEnabled : false
- }]
- }, function(ret, err) {
- // 通过滑动触发
- navigationBar.config({
- key : 'selectedIndex',
- value : ret.index
- }, function(ret, err) {
- console.log('oldValue:' + ret.oldValue + ',newValue' + ret.newValue);
- });
- });
复制代码
navigationBar 和 frameGroup 都有回调,当滑动frame时,就会重复调用 navigationBar , 快速连续滑动后,动画效果就停不下来了,导致程序崩溃。。。
请问如何防止重复调用,有什么方法
|
|