这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
isAutoLocale
只读特性在
IDBIndex
interface returns a
布尔
indicating whether the index had a
locale
value of
auto
specified upon its creation (see
createIndex()
's optionalParameters
)。
var myIndex = objectStore.index('index');
console.log(myIndex.isAutoLocale);
A
布尔
.
In the following example we open a transaction and an object store, then get the index
lName
from a simple contacts database. We then open a basic cursor on the index using
IDBIndex.openCursor
— this works the same as opening a cursor directly on an
ObjectStore
使用
IDBObjectStore.openCursor
except that the returned records are sorted based on the index, not the primary key.
isAutoLocale
value is logged to the console.
function displayDataByIndex() {
tableEntry.innerHTML = '';
var transaction = db.transaction(['contactsList'], 'readonly');
var objectStore = transaction.objectStore('contactsList');
var myIndex = objectStore.index('lName');
console.log(myIndex.isAutoLocale);
myIndex.openCursor().onsuccess = function(event) {
var cursor = event.target.result;
if(cursor) {
var tableRow = document.createElement('tr');
tableRow.innerHTML = '<td>' + cursor.value.id + '</td>'
+ '<td>' + cursor.value.lName + '</td>'
+ '<td>' + cursor.value.fName + '</td>'
+ '<td>' + cursor.value.jTitle + '</td>'
+ '<td>' + cursor.value.company + '</td>'
+ '<td>' + cursor.value.eMail + '</td>'
+ '<td>' + cursor.value.phone + '</td>'
+ '<td>' + cursor.value.age + '</td>';
tableEntry.appendChild(tableRow);
cursor.continue();
} else {
console.log('Entries all displayed.');
}
};
};
Not currently part of any specification.
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
isAutoLocale
非标
|
Chrome 不支持 No | Edge 不支持 No | Firefox 43 | IE 不支持 No | Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 43 | Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 不支持 No |
完整支持
不支持
实验。期望将来行为有所改变。
非标。预期跨浏览器支持较差。
IDBDatabase
IDBTransaction
IDBKeyRange
IDBObjectStore
IDBCursor
IDBIndex
isAutoLocale
keyPath
locale
multiEntry
名称
objectStore
unique
IDBCursor
IDBCursorSync
IDBCursorWithValue
IDBDatabase
IDBDatabaseException
IDBDatabaseSync
IDBEnvironment
IDBEnvironmentSync
IDBFactory
IDBFactorySync
IDBIndexSync
IDBKeyRange
IDBObjectStore
IDBObjectStoreSync
IDBOpenDBRequest
IDBRequest
IDBTransaction
IDBTransactionSync
IDBVersionChangeEvent
IDBVersionChangeRequest