Open metrey opened 3 years ago
So, now I fixed it by write a plugin follow the v-localforage: https://github.com/datalogix/v-localforage/blob/master/src/index.js
as following:
npm install localforage
Write plugin: plugin/localforage.client.js and load it as normal nuxtjs case:
import Vue from 'vue
import localforage from 'localforage'
Vue.use(VueLocalforage)
/* istanbul ignore next */
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VueLocalforage)
}
// Place your option here
const options = {}
Vue.$localforage = localforage.createInstance(options)
Vue.prototype.$localforage = Vue.$localforage
if (options.instances) {
for (const instance of options.instances) {
const name = instance.storeName || instance.name
Vue.$localforage[name] = localforage.createInstance(instance)
Vue.prototype.$localforage[name] = Vue.$localforage[name]
}
}
So for this module, need to fix as above solution, I don't need any module.
Hi @metrey I can't reproduce your problem
@ricardogobbosouza I just setup as mention in https://github.com/nuxt-community/localforage-module/issues/15#issue-839503403 and got that error, I don't know if at your side, you have some where that could load that.
As now, it works by using the solution I mention in https://github.com/nuxt-community/localforage-module/issues/15#issuecomment-806419070
Hi @metrey Please provide a repository for reproduction
Happens to me too with a fresh default install of nuxt 2.15.7
, Javascript with Babel (no typescript).
The installation is following as:
Add @nuxtjs/localforage to the buildModules section of nuxt.config.js
When use in a Vue component, still got this error:
Uncaught (in promise) TypeError: this.$localForage is undefined
Also try to add in block of modules in nuxt.config.js also still error, this.$localForage not delcare by the module