Answer the question
In order to leave comments, you need to log in
How to reach a variable declared in a Vue instance?
I found a wrapper for caching https://www.npmjs.com/package/vue-idb
I can't figure out how to use it correctly using the example from the documentation:
import Vue from 'vue'
import VueIdb from 'vue-idb'
Vue.use(VueIdb)
const idb = new VueIdb({
version: 1,
database: 'test',
schemas: [
{ tests: 'id, title, created_at, updated_at' },
{ posts: 'id, owner' }
]
})
new Vue({
el: '#app',
idb: idb,
render: h => h(App)
})
axios.get(base_url + '/api/industry')
.then((response) => {
idb.test= response.data; // так не получается
})
.catch((error) => {
console.log(error);
});
Answer the question
In order to leave comments, you need to log in
this.$db or vm.$db
Here is how it is injected into the prototype of the view in the source code.
https://github.com/ddgll/vue-idb/blob/dbe43f7e77bd...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question