复制工作正常,但是当我测试时它崩溃了。
这是代码的错误,哪里出了问题。.我想
componentDidMount = async() => {
try{
const request = await window.indexedDB.open("QuestionData",1)
request.onsuccess = (event) => {
const db = request.result;
const transaction = db.transaction('Questions' , "readwrite");
const store = transaction.objectStore('Questions');
const get = store.get(1)
get.onsuccess = () =>{
this.setState({
data: get.result.data
})
}
}
}catch(err){console.log(err)}
}
这是考验的内容
test('should render btn', () => {
const wrapper = mount(<App />)
const btn = wrapper.find('.btn')
expect(btn.length).toBe(1)
})
现在出错!
console.log src / App.js:36 TypeError:无法读取未定义的属性“ open”