是否有可能覆盖sencha触摸旋转木马上一个和下一个功能

is it possible to override sencha touch carousel previous and next functions?

本文关键字:上一个 下一个 功能 旋转木马 触摸 有可能 覆盖 sencha 是否      更新时间:2023-09-26

我正在使用sencha touch开发手机网站。

Ext.setup( {
    onReady: function() {
      new Ext.Carousel({
        fullscreen: true,
        items: [
          {
            html: "Item1"
},
{ 
  html : "Item2"
}
]});};});

是我使用的。但是可以重写next()和prev()函数吗?实际上,我想在这些函数中做一些事情,然后调用parent。next(),我的意思是相同的函数。任何帮助吗?我看到了链接http://www.sencha.com/forum/showthread.php?110036-Override-Method但是我不能理解

根据您的需求参考此代码。

Ext.Loader.setConfig({
    enabled: true
});
Ext.application({
    launch: function () {
        Ext.define('MyApp.view.inbox.MyInbox', {
            extend: 'Ext.Carousel',
            config: {
                itemId:'test',
                fullscreen: true,
                items: [{
                    html: "Item1"
                },{ 
                    html : "Item2"
                }]
            },
            next:function(){
                //Do your thing
                //This code will call the next in the super class
                this.callParent(arguments);
            },
            prev:function(){
                //Do your thing
                //This code will call the prev in the super class
                this.callParent(arguments);
            }
        });
        Ext.create('MyApp.view.inbox.MyInbox');
    }
});