TabBar.js
1.3 KB
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
define(function () {
    'use strict';
    
    function TabBar() {
        this.store = {
            datas: []
        };
    }
    TabBar.prototype = {
        transferToVM: function (dm) {
            var datas = dm.datas || [];
            
            return {
                tabs: datas.map(function (data) {
                    var picpath = data.picpath;
                    var picpath2 = data.picpath2;
                    var itemClass = " ";
                    if(!picpath && !picpath2) {
                        itemClass += "wev-tabbar-noimg"
                    } else {
                        picpath = picpath || picpath2;
                        picpath2 = picpath2 || picpath;
                        itemClass += picpath == picpath2 ? "wev-tabbar-singleimg" : "";
                    }
                    return {
                        text: data.showname,
                        href: "javascript: void(0)",
                        itemClass: itemClass,
                        icon: {
                            normal: picpath,
                            active: picpath2
                        },
                        remind: data.isremind == 1
                    };
                }),
                isFixedTop: dm.isFixedTop == '1'
            };
        }
    };
    return TabBar;
});