以下是几个内置函数,它们在Ext JS中大量使用.
此类检查平台你正在使用,无论是手机还是台式机,Mac或Windows操作系统.以下是与Ext.is类相关的方法.
Sr.No | 方法&说明 |
---|---|
1 | Ext.is.Platforms 此函数返回此版本可用的平台. 例如,当您运行以下函数时,它返回类似这样的东西; [Object {property ="platform",regex = RegExp,identity ="iPhone"}, Object {property ="platform",regex = RegExp,identity ="iPod"}, Object {property ="userAgent",regex = RegExp,identity ="iPad"}, Object {property ="userAgent",regex = RegExp,identity ="Blackberry"}, Object {property ="userAgent",regex = RegExp,identity ="Android"}, Object {property =" platform",regex = RegExp,identity ="Mac"}, Object {property ="platform",regex = RegExp,identity ="Windows"}, Object {property ="platform",regex = RegExp,identity ="Linux"}] |
2 | Ext.is.Android 如果您使用的是Android操作系统,此函数将返回true,否则返回false. |
3 | Ext.is.Desktop 如果您为应用程序使用桌面,则此函数将返回true,否则返回false. |
4 | Ext .is.Phone 如果您使用手机,此功能将返回true,否则返回false. |
5 | Ext.is.iPhone 如果您使用iPhone,此函数将返回true,否则返回false. |
6 | Ext.is.iPod 这函数将返回true,如果你正在使用iPod,否则它返回false. |
7 | Ext.is.iPad Th函数将返回true,如果您使用的是iPad,否则返回false. |
8 | Ext.is.Windows 此函数将返回true ,如果您使用的是Windows操作系统,则返回false. |
9 | Ext.is.Linux 如果你是这个函数将返回true使用Linux操作系统,否则返回false. |
10 | Ext.is.Blackberry 如果您使用Blackberry,此函数将返回true,否则返回false. |
11 | Ext.is.Mac 如果您使用的是Mac操作系统,此函数将返回true,否则返回false. |
如名称所示,此类提供信息如果浏览器/设备的当前环境支持该功能,则离线.
Sr.No | 方法&说明 |
---|---|
1 | Ext.supports.History 它检查设备是否支持HTML 5历史记录作为window.history.如果设备支持历史记录,则返回 true ,否则返回false. |
2 | Ext.supports.GeoLocation 检查设备是否支持地理定位方法与否.在内部,它检查navigator.geolocation方法. |
3 | Ext.supports.Svg 它检查设备是否支持HTML 5功能可缩放矢量图形(svg)方法.在内部,它检查doc.createElementNS&& !! doc.createElementNS("http:/"+"/www.w3.org/2000/svg","svg").createSVGRect. |
4 | Ext.supports.Canvas 它检查设备是否支持HTML 5功能画布来绘制方法.在内部,它检查doc.createElement('canvas').getContext并根据此方法的输出返回一个值. |
5 | Ext.supports.Range 它检查浏览器是否支持document.createRange方法. |
Ext.String类有各种方法可以处理字符串数据.最常用的方法是编码解码,修剪,切换,urlAppend等.
编码解码功能 : 这些是Ext.String类中可用于编码和解码HTML值的函数.
Sr.No | 方法&说明 |
---|---|
1 | Ext.String.htmlEncode 此函数用于对html值进行编码以使其可解析. 示例 : Ext.String.htmlEncode("< p> Hello World</p>"); 输出 - "& lt; p& gt; Hello World& lt;/p& gt;". |
2 | Ext.String.htmlDecode 此函数用于解码编码的html值. 示例 : Ext.String.htmlDecode("& lt; p& gt; Hello World& lt;/p& gt;"); 输出 - "< p> Hello World</p>" |
3 | Ext.String.trim 此函数用于修剪字符串中不需要的空格. Ext.String.trim('hello'); 输出 - "你好" |
4 | Ext.String.urlAppend 此方法用于在URL中附加值字符串. 示例 : Ext.String.urlAppend( 'https://www.google.com','你好'); 输出 - "https://www.google.com?hello" Ext.String.urlAppend('https://www.google.com?index=1','hello'); 输出 - "https://www.google.com?index=1&hello" |
5 | Ext.String.toggle 此函数用于在两个不同的值之间切换值. 示例 : var toggleString ='ASC' toggleString = Ext.String.toggle(a,'ASC','DESC'); 输出 - DESC as toggleString具有值ASC.再说一次,如果我们 打印相同,这次我们将获得toggleString ="ASC",因为 它的值为'DESC'. 类似于三元运算符 toggleString =((toggleString =='ASC')?'DESC':'ASC'); |
Sr.No | 方法&说明 |
---|---|
1 | Ext.userAgent() 此函数提供有关浏览器userAgent的信息. UserAgent用于识别Web服务器的浏览器和操作系统. 示例 : 如果你在Mozilla工作,它会返回类似:"mozilla/5.0(windows nt 6.1; wow64; rv:43.0)gecko/20100101 firefox/43.0" |
2 | 版本相关功能 如果调用与IE相关的函数,则此函数返回当前正在使用的浏览器的版本.在Firefox浏览器中,它返回0.这些函数是Ext.firefoxVersion,Ext.ieVersion等. 示例 : 如果您使用的是Firefox浏览器,并且调用方法Ext.ieVersion来获取IE的版本,那么它将返回0.如果您在IE浏览器中使用相同的方法,那么它将返回您正在使用的版本,如8, 9,等等. |
3 | Ext.getVersion() 此函数返回当前正在使用的Ext JS版本. 示例 : 如果调用Ext.getVersion(),它将返回一个值数组,如版本,短版本等. Ext.getVersion().version返回当前版本的Ext JS使用在程序中,例如"4.2.2". |
4 | 浏览器相关函数 这些函数根据正在使用的浏览器返回布尔值.这些方法是Ext. isIE,Ext.isIE6,Ext.isFF06和Ext.isChrome. 示例 : 如果您使用的是Chrome浏览器,那么函数Ext.isChrome将会返回true all,否则返回false. |
5 | Ext.typeOf() 此函数返回变量的数据类型. 示例 : var a = 5; var b ='hello'; Ext.typeOf(a); 输出 - 数字 Ext.typeOf(b); 输出 - 字符串 |
6 | 与数据类型相关的方法 : 这些函数根据变量的数据类型返回布尔值 示例 : var a = ['a','bc']; var b ='hello'; var c = 123; var emptyVariable; var definedVariable; function extraFunction(){return true;} |
Ext.isArray(a); | //返回true |
Ext.isString(b); | //返回true |
Ext.isNumber(c); | //返回true |
Ext.isEmpty(emptyVariable); | //返回true |
Ext.isEmpty(b); | //返回false |
Ext.isDefined(definedVariable); | //返回true |
Ext.isfunction(extraFunction); | //返回true |