nuxt-community / localforage-module Goto Github PK
View Code? Open in Web Editor NEWLocalforage module for Nuxt.js
License: MIT License
Localforage module for Nuxt.js
License: MIT License
Better typing support would improve the life of many people including myself !
Hi,
Any notes on the new version? :)
I am still on 1.0.2
I am doing something typical, reloading the storage when the app is loaded. My approach so far is to put it in the create method of my default layout. obviously that is problematical since I would need to do that in all other layouts. I was thinking about doing this in an middleware, however I just noticed, that the localforage is not available in the context of the middleware. I was checking the documentation, to see if there is something about that... Doing that I realized I have localforage in modules
not buildModules
. However changing that, my index page doesn't load anymore...
I am doing something like this in the default layout:
created() {
if (!this.$store.getters[DB_LOADED]())
reload_storage(this.$store, this.$localForage)
db_loaded is a flag in my store which is set after localForage is loaded. Then in a watch method to that store variable I fetch stuff from the server and set another flag in the store to initialized, which will finally allows the page to be created:
<v-container v-if="initialized">
<nuxt/>
There is probably a better way to do all these initial steps involving the localforage. Any guidelines would be really appreciated.
Hi,
I am able to use local forage as a method, but I can not use it in store.. I tried different options but I could not manage to do it.
As a method, this is what I am doing
async localForage () {
let data = {
name: 'test',
operation: 'Nav-Business'
}
await this.$localForage.setItem('nav', data)
.then(data => {
console.log('Working', data)
})
.catch(error => {
console.log(error)
})
}
Thnx in advance
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These problems occurred while renovating this repository. View logs.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
.github/workflows/ci.yml
actions/setup-node v2
actions/checkout v2
actions/cache v2
codecov/codecov-action v1
package.json
v-localforage ^2.0.1
The installation is following as:
npm install --save-dev @nuxtjs/localforage
Add @nuxtjs/localforage to the buildModules section of nuxt.config.js
buildModules: [
// https://go.nuxtjs.dev/eslint
// '@nuxtjs/eslint-module',
// https://go.nuxtjs.dev/vuetify
'@nuxtjs/vuetify',
'@nuxtjs/localforage'
],
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
Installed @nuxtjs/localforage
normally
Actual code:
modules: [
// Doc: https://github.com/nuxt-community/axios-module#usage
'@nuxtjs/axios',
['@nuxtjs/localforage', {
driver: localforage.LOCALSTORAGE,
}]
],
Error:
driver: localforage.LOCALSTORAGE,
^
ReferenceError: localforage is not defined
at Object.<anonymous> (D:\xampp\htdocs\suporteps-extension\nuxt.config.js:56:13)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at exports.loadNuxtConfig.argv (D:\xampp\htdocs\suporteps-extension\node_modules\nuxt\bin\common\utils.js:18:15)
at Object.<anonymous> (D:\xampp\htdocs\suporteps-extension\node_modules\nuxt\bin\nuxt-dev:63:20)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
error An unexpected error occurred: "Command failed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.