Egret实现滚动排行榜

首先用EUI布局做好两个皮肤,主要就是列表的使用,主要代码:

class Rank extends eui.Component {

    private listGoods: eui.List;
   
    constructor() {
        super();
        this.addChild(new PlayMusic());
        this.addEventListener(eui.UIEvent.COMPLETE, this.uiCompHandler, this);
        this.skinName = "src/GameRank/rankUI.exml";
        this.once(egret.Event.ADDED_TO_STAGE, this.init, this);
    }


    //皮肤加载完成
    private uiCompHandler() {
        this.listGoods.itemRenderer = GoodsListIRSkin;

        this.listGoods.dataProvider = new eui.ArrayCollection(data)
    }

class GoodsListIRSkin extends eui.ItemRenderer {
    
    constructor() {
        super();
        this.addEventListener(eui.UIEvent.COMPLETE, this.uiCompHandler, this);
        this.skinName = "rankListUI";


    }
    private uiCompHandler() {
       
    }  
}

eui代码:

1.rankUI.exml



    
    
    
        
            
                
                    
                
            
        
        






    
    
        
            
                
                
            
        
    
    
        
            
                
                
            
        
    






2.rankListUI.exml





    







你可能感兴趣的:(Egret)