fix: 完善单测demo(indexedDB相关)

This commit is contained in:
chenjinsong
2023-01-17 17:56:44 +08:00
parent 38006bd964
commit 04e186e7d8
9 changed files with 88 additions and 36 deletions

View File

@@ -11,12 +11,14 @@
import { useRoute, useRouter } from 'vue-router'
import axios from 'axios'
import { ref } from 'vue'
import indexedDBUtils from '@/indexedDB'
export default {
name: 'Test',
data () {
return {
count: 0,
obj: { id: 1, title: 'title' }
obj: { id: 1, title: 'title' },
indexedDBValue: null
}
},
methods: {
@@ -35,6 +37,12 @@ export default {
axios.get('/api/getCount').then(response => {
this.count = response.data
})
},
async setIndexedDBValue () {
await indexedDBUtils.selectTable('test').put({ id: 1, name: 'test' })
},
async getIndexedDBValue () {
this.indexedDBValue = await indexedDBUtils.selectTable('test').get(1)
}
},
setup () {