|
apiready = function(){
NVNavigationBar();
openFrameGroup();
function NVNavigationBar() {
var NVNavigationBar = api.require('NVNavigationBar');
NVNavigationBar.open({
rect: {
x: 0,
y: $('header').height(),
w: api.frameWidth,
h: 42
},
styles: {
orientation: 'horizontal',
bg: '#F8F8F8',
bgAlpha: 1,
font: {
size: 14,
sizeSelected: 18,
color: '#979797',
colorSelected: '#ff7e00',
alpha: 1
},
itemSize: {
w:api.frameWidth/3,
h: 44
}
},
items: [{
title: '全国新闻',
bg: '#F8F8F8',
bgSelected: '#F8F8F8'
},{
title: '海南新闻',
bg: '#F8F8F8',
bgSelected: '#F8F8F8'
},{
title: '园区新闻',
bg: '#F8F8F8',
bgSelected: '#F8F8F8'
}],
selectedIndex: 0,
fixedOn: api.frameName,
id: 'first'
}, function(ret, err) {
console.log(JSON.stringify(ret))
if (ret.eventType == 'click'){
api.setFrameGroupIndex({name: 'main',index:ret.index});
}
});
}
function openFrameGroup(){
api.openFrameGroup({
name: 'main',
rect: {
x: 0,
y: $('header').height()+35,
w: 'auto',
h: 'auto'
},
frames: [{
name: 'news-national',
url: './news-national.html',
bgColor: '#fff',
allowEdit:true
}, {
name: 'news-Hainan',
url: './news-Hainan.html',
bgColor: '#fff',
allowEdit:true
}, {
name: 'news-park',
url: './news-park.html',
bgColor: '#fff',
allowEdit:true
}]
}, function(ret, err,index) {
var NVNavigationBar = api.require('NVNavigationBar');
NVNavigationBar.setSelected({index:ret.index});
});
}
}
代码是这样的 ,我有考虑过 是不是因为触发函数的问题,我把openFrameGroup() 放在第一函数的ret回调==show的时候 在调用,也是一样的 |
|