let db = window!().indexed_db().unwrap().unwrap();
let opened_request = match db.open("test-my") {
Ok(v) => { v },
Err(res) => {
let s = Array::from(&res);
console::log(&s);
return;
}
};
let trans = match opened_request.transaction() {
Some(v) => { v },
None => {
log_info_str!("没有获取到事务接口"); //一直在这里出错
return;
}
};
let db = trans.db();
let store = match db.create_object_store("my-test") {
Ok(v) => { v },
Err(err) => {
let s = Array::from(&err);
console::log(&s);
return;
}
};
let js = JsValue::from("hello world");
let _request = match store.put(&js) {
Ok(v) => { v },
Err(err) => {
let s = Array::from(&err);
console::log(&s);
return;
}
};
1
共 2 条评论, 1 页
评论区
写评论没玩儿过,回答不了😂