KeyboardLayoutMap:size 属性
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
io error: No such file or directory (os error 2) (/home/runner/work/yari/yari/mdn/translated-content/files/zh-cn/web/api/keyboard_api/index.md)
KeyboardLayoutMap
接口的 size
只读属性返回映射中的元素数量。
该属性与 Map.prototype.size
相似。
值
一个数字。
示例
以下示例获取英文 QWERTY 键盘上位置或布局特定字符串及其关联键盘代码的数量。
js
navigator.keyboard.getLayoutMap().then((keyboardLayoutMap) => {
console.log(keyboardLayoutMap.size);
});
规范
Specification |
---|
ECMAScript Language Specification # sec-get-map.prototype.size |
浏览器兼容性
BCD tables only load in the browser