-
Notifications
You must be signed in to change notification settings - Fork 1
/
aui-fnav-rbtn.sublime-snippet
63 lines (62 loc) · 2.53 KB
/
aui-fnav-rbtn.sublime-snippet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<snippet>
<content><![CDATA[
apiready = function(){
var header = $api.byId('aui-header');
$api.fixStatusBar(header);
var headerPos = $api.offset(header);
var body_h = $api.offset($api.dom('body')).h;
var footer_h = $api.offset($api.byId('aui-footer')).h;
api.openFrameGroup ({
name: '${1:footer_tab_demo}',
scrollEnabled:true,
rect:{x:0, y:headerPos.h, w:'auto', h:body_h - headerPos.h - footer_h},
index:0,
preload:3,
frames:
[{
name: '${2:footer_tab_1}',
url: '${3:footer_tab_1}.html',
bounces:false
}]
}, function(ret, err){
var footer = $api.byId('aui-footer');
var footerAct = $api.dom(footer, '.aui-bar-tab li.${4:active-warning}');
$api.removeCls(footerAct, 'active-warning');
var name = ret.name;
var index = ret.index;
if(index==0){
$api.text($api.byId('header-title'),'栏目1');
$api.addCls($api.byId('tabbar1'), '${5:active-warning}');
}else if(index==1){
$api.text($api.byId('header-title'),'栏目2');
$api.addCls($api.byId('tabbar2'), '${6:active-warning}');
}else if(index==2){
$api.text($api.byId('header-title'),'栏目3');
$api.addCls($api.byId('tabbar3'), '${7:active-warning}');
}else if(index==3){
$api.text($api.byId('header-title'),'栏目4');
$api.addCls($api.byId('tabbar4'), '${8:active-warning}');
}
});
$api.addEvt($api.byId('back'), 'click', function(){
api.closeWin();
});
};
function randomSwitchBtn(obj, name, index) {
$api.text($api.byId('header-title'),name);
var footer = $api.byId('aui-footer');
var footerAct = $api.dom(footer, '.aui-bar-tab li.${9:active-warning}');
$api.removeCls(footerAct, 'active-warning');
$api.addCls(obj, '${10:active-warning}');
api.setFrameGroupIndex({
name: '${11:footer_tab_demo}',
index: index
});
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>aui-fnav-rbtn</tabTrigger>
<description>底部导航切换JS部分</description>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>