JavaScript 对象和函数列表¶
QML 中支持的对象、函数和属性列表。
本参考包含Qt中JavaScript engine
支持的对象、函数和属性列表。详细描述请参见ECMA-262规范。
全局对象¶
值属性¶
NaN
无穷大
未定义
函数属性¶
eval(x)
parseInt(字符串, 基数)
parseFloat(字符串)
isNaN(数字)
isFinite(number)
decodeURI(encodedURI)
decodeURIComponent(encodedURIComponent)
encodeURI(uri)
encodeURIComponent(uriComponent)
escape(字符串)
unescape(string)
构造函数属性¶
对象
函数
数组
数组缓冲区
字符串
布尔值
数字
数据视图
日期
承诺
正则表达式
地图
WeakMap
设置
WeakSet
SharedArrayBuffer
符号
错误
EvalError
范围错误
ReferenceError
语法错误
类型错误
URI错误
其他属性¶
原子操作
数学
JSON
反射
代理
对象对象¶
对象构造函数¶
函数属性¶
getPrototypeOf(O)
setPrototypeOf(O, P)
getOwnPropertyDescriptor(O, P)
获取对象O的所有自身属性的描述符
getOwnPropertyNames(O)
获取对象O自身的所有Symbol属性
assign(O [, Properties])
创建(O [, 属性])
defineProperty(O, P, Attributes)
定义属性(O, 属性)
entries(O)
is(V1, V2)
keys(O)
值(O)
密封(O)
isSealed(O)
冻结(O)
isFrozen(O)
preventExtensions(O)
isExtensible(O)
对象原型¶
函数属性¶
toString()
toLocaleString()
valueOf()
hasOwnProperty(V)
isPrototypeOf(V)
propertyIsEnumerable(V)
__defineGetter__(P, F)
__defineSetter__(P, F)
函数对象¶
函数原型¶
函数属性¶
toString()
apply(thisArg, argArray)
调用(thisArg [, arg1 [, arg2, …]])
绑定((thisArg [, arg1 [, arg2, …]])
[Symbol.hasInstance](O)
数组对象¶
数组原型对象¶
函数属性¶
toString()
toLocaleString()
concat([item1 [, item2 [, …]]])
copyWithin([item1 [, item2 [, …]]])
entries()
填充(item [, index1 [, index2]])
join(分隔符)
find(callbackfn [, thisArg]) // ECMAScript 6: 在 Qt 5.9 中添加
findIndex(callbackfn [, thisArg]) // ECMAScript 6: 在 Qt 5.9 中添加
includes(item)
keys()
pop()
push([item1 [, item2 [, …]]])
reverse()
shift()
slice(开始, 结束)
排序(比较函数)
splice(start, deleteCount[, item1 [, item2 [, …]]])
unshift([item1 [, item2 [, …]]])
indexOf(searchElement [, fromIndex])
lastIndexOf(searchElement [, fromIndex])
every(callbackfn [, thisArg])
some(callbackfn [, thisArg])
forEach(callbackfn [, thisArg])
map(callbackfn [, thisArg])
filter(callbackfn [, thisArg])
reduce(callbackfn [, initialValue])
reduceRight(callbackfn [, initialValue])
values()
[Symbol.iterator]()
字符串对象¶
字符串原型对象¶
函数属性¶
toString()
valueOf()
charAt(pos)
charCodeAt(pos)
codePointAt(pos)
concat([string1 [, string2 [, …]]])
endsWith(searchString [, endPosition ]) // ECMAScript 6: 在 Qt 5.8 中添加
includes(searchString [, position ]) // ECMAScript 6: 在5.8版本中添加
indexOf(searchString ,position)
lastIndexOf(searchString, position)
localeCompare(that)
匹配(regexp)
normalize()
padEnd(length [, string])
padStart(长度 [, 字符串])
repeat(count) // ECMAScript 6: 在 Qt 5.9 中添加
替换(searchValue, replaceValue)
搜索(regexp)
slice(开始, 结束)
split(separator, limit)
startsWith(searchString [, position ]) // ECMAScript 6: 在 Qt 5.8 中添加
substr(start, length)
substring(start, end)
toLowerCase()
toLocaleLowerCase()
toUpperCase()
toLocaleUpperCase()
trim()
[Symbol.iterator]()
此外,QML引擎向String
原型添加了以下函数:
布尔对象¶
布尔原型对象¶
函数属性¶
toString()
valueOf()
数字对象¶
数字原型对象¶
函数属性¶
toString(基数)
toLocaleString()
valueOf()
toFixed(fractionDigits)
toExponential(fractionDigits)
toPrecision(precision)
此外,QML引擎向Number原型添加了以下函数:
fromLocaleString(locale, number)
toLocaleCurrencyString(locale, symbol)
toLocaleString(locale, format, precision)
数字对象¶
值属性¶
NaN
负无穷大
正无穷大
最大值
MIN_VALUE
EPSILON // ECMAScript 6: 在 Qt 5.8 中添加
MAX_SAFE_INTEGER
MIN_SAFE_INTEGER
函数属性¶
isFinite(x) // ECMAScript 6: 在 Qt 5.8 中添加
isInteger(x)
isSafeInteger(x)
isNaN(x) // ECMAScript 6: 在 Qt 5.8 中添加
数学对象¶
值属性¶
E
LN10
LN2
LOG2E
LOG10E
PI
SQRT1_2
SQRT2
函数属性¶
abs(x)
acos(x)
acosh(x)
asin(x)
asinh(x)
atan(x)
atanh(x)
atan2(y, x)
cbrt(x)
ceil(x)
clz32(x)
cos(x)
cosh(x)
exp(x)
expm1(x)
floor(x)
fround(x)
hypot(x, y)
imul(x, y)
log(x)
log10(x)
log1p(x)
log2(x)
max([value1 [, value2 [, …]]])
min([value1 [, value2 [, …]]])
pow(x, y)
random()
round(x)
sign(x) // ECMAScript 6: 在 Qt 5.8 中添加
sin(x)
sinh(x)
sqrt(x)
tan(x)
tanh(x)
截断(x)
日期对象¶
日期原型对象¶
函数属性¶
toString()
toDateString()
toTimeString()
toLocaleString()
toLocaleDateString()
toLocaleTimeString()
valueOf()
getTime()
getFullYear()
getUTCFullYear()
获取月份()
getUTCMonth()
获取日期()
getUTCDate()
getDay()
getUTCDay()
获取小时数()
getUTCHours()
getMinutes()
getUTCMinutes()
getSeconds()
getUTCSeconds()
getMilliseconds()
getUTCMilliseconds()
getTimeZoneOffset()
设置时间(time)
setMilliseconds(ms)
setUTCMilliseconds(ms)
setSeconds(秒 [, 毫秒])
setUTCSeconds(秒 [, 毫秒])
设置分钟数(min [, sec [, ms]])
setUTCMinutes(min [, sec [, ms]])
设置小时数(小时 [, 分钟 [, 秒 [, 毫秒]]])
setUTCHours(小时 [, 分钟 [, 秒 [, 毫秒]]])
设置日期(date)
setUTCDate(date)
setMonth(月份 [, 日期])
setUTCMonth(month [, date])
设置年份(year)
设置完整年份(年 [, 月 [, 日]])
setUTCFullYear(year [, month [, date]])
toUTCString()
toGMTString()
toISOString()
toJSON()
[Symbol.toPrimitive](hint)
此外,QML引擎向Date原型添加了以下函数:
timeZoneUpdated()
toLocaleDateString(locale, format)
toLocaleString(locale, format)
toLocaleTimeString(locale, format)
正则表达式对象¶
正则表达式原型对象¶
函数属性¶
exec(string)
测试(string)
toString()
错误对象¶
错误原型对象¶
值属性¶
名称
消息
函数属性¶
toString()
JSON对象¶
函数属性¶
解析(文本 [, 恢复器])
stringify(value [, replacer [, space]])