created(){
local.config({
driver: [local.INDEXEDDB,
local.WEBSQL,
local.LOCALSTORAGE],
// Force WebSQL; same as using setDriver()
name : 'myApp',
version : 1.0,
size : 1073741824, // Size of database, in bytes. WebSQL-only for now.
storeName : 'keyvaluepairs', // Should be alphanumeric, with underscores.
description : 'some description'
});
var store = local.createInstance({
name: "nameHere"
});
let startTime = new Date().getTime()
var obj = []
for(let i=0;i<100000;i++){
obj.push({ sku: "EE00EU"+i,uid:'22OIERP'+i,name:'我们是大家都是啊附近的萨法实打实打发打发的' });
}
},
local.config({
driver: [local.INDEXEDDB,
local.WEBSQL,
local.LOCALSTORAGE],
// Force WebSQL; same as using setDriver()
name : 'myApp',
version : 1.0,
size : 1073741824, // Size of database, in bytes. WebSQL-only for now.
storeName : 'keyvaluepairs', // Should be alphanumeric, with underscores.
description : 'some description'
});
var store = local.createInstance({
name: "nameHere"
});
let startTime = new Date().getTime()
var obj = []
for(let i=0;i<100000;i++){
obj.push({ sku: "EE00EU"+i,uid:'22OIERP'+i,name:'我们是大家都是啊附近的萨法实打实打发打发的' });
}
store.setItem('key', obj, function(err, result) {
if(result){
store.getItem('key', function(err, value) {
if (err) {
console.error('Oh noes!');
} else {
console.log(value)
// console.log(res)
let selector = '22OIERP77777'
let queryData =lodash.find(value, function(codeObj){
let data = ''
if(codeObj.sku === selector ||
codeObj.uid === selector){
data = codeObj;
}
return data
});
alert("插入10W条数据所花时间:"+(new Date().getTime() - startTime ))
alert(queryData.sku)
}
});
}
});},