我正在使用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/