javascript - 如何通过 Android 和 iOS 设备更改 Xtype 属性?

标签 javascript android ios extjs sencha-touch

我正在使用Extjs6.0.2创建项目,但是现在我在创建xtype时遇到问题:'namefield'导致这种类型的xtype在Android上支持而不支持iOS设备,但是我希望我会找到解决方案,我怎样才能通过使用这个来进行xtype。

lookupReference('txtPhoneNo').setConfig('xtype','numbercode') 此代码替换在 main.js 中,

{

            xtype:'fieldset',
            items:[{

                minLength: 9,
                maxLength: 10, 
                xtype: 'textcode',
                cls: 'acledaTxt',
                itemId: 'txtPhoneNo',
                id: 'phonNo' ,
                reference: 'txtPhoneNo',

            }]

        },

最佳答案

您无法更改组件 xtype 运行时。

相反,您可以创建两个组件并使用

隐藏或显示正确的组件
if (Ext.os.is.iOS) {
    // iPad, iPod, iPhone, etc.
}

或者您可以像这样动态地创建组件:

var xtype='';
if (Ext.os.is.iOS) {
    xtype='IOSXTYPE'
}else if(Ext.os.is.Android){
    xtype='AndroidXTYPE'
}
var component= Ext.create({
    xtype:xtype
});

关于javascript - 如何通过 Android 和 iOS 设备更改 Xtype 属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40121846/

相关文章:

ios - 从未调用过通过 loadNibNamed() 从 xib 加载按钮

javascript - 如何使用 Javascript/AngularJs 将按钮放置在图像上的特定位置(x,y)

android - 当列表大小为零时,SwipeRefreshLayout 不会在滑动时刷新

javascript - Plotly 悬停文本不显示

java - Android Google Play 抽屉导航样式

android - 如何在android中播放m3u文件?

android - 在 iOS 中使用 gmail API 验证用户实际上是大学生的最佳方法?

ios - 提取 NSDate() 的值

javascript - 首次单击 Mapbox map 后,GeoJson LineString 仅加载一次

javascript - 某些变换是否适用于文本而不适用于矩形?