SegControl.js 714 Bytes
define(function () {
    'use strict';

    function SegControl() { }

    SegControl.prototype = {
        transferToVM: function (dm) {
            var btns = dm.btn_datas || [];
            var activeIndex = dm.activeIndex;
            if(activeIndex==null || activeIndex=='' || activeIndex==-1){
            	activeIndex = 0;
            }
            return {
                segments: btns.map(function (btn, index) {
                    return { 
                        remind: btn.isremind == 1,
                        text: btn.segName || " ",
                        active: index == activeIndex
                    };
                })
            };
        }
    };

    return SegControl;
});