How do I access the local file under Electron mode in my Quasar project ?
-
Help wanted description
I’m pretty sure about that I can use some Node.js builtins’ module like
fs
andpath
, but I don’t know how to use them in my Vue SFC(single file component).My requirements
I have a form in my
Settings.vue
, it will accept three fields, I will put them into an object :{ // (type: LinkTemplate) name: 'Google', template: 'https://www.google.com/search?q={%s}' desc: 'xxx ... some comments here.' },
I’d like to load an
Array<LinkeTemplate>
from a local json file.
but I don’t know how to use thefs
Node.js API here.Something else need to learn?
I do know that Electron has two independent process
Main
andRender
.
How do I use the System Level API (like File I/O) easily in a complicated Web Application like Quasar?
It seems I need a lot of Directory Tricks and Config Settings.It seems that there’s nothing useful for this at the official documentation of Quasar.
Thanks !
-
Email: tmy991106@gmail.com
This Email may make our communication more convenient … -
If you want info about specific Electron features you are often better helped in the Electron community:
https://www.electronjs.org/communityOn topic, here’s a thread about file access:
https://stackoverflow.com/questions/55983687/asynchronously-read-a-file-line-by-line-with-electron-vueAlso googled this ‘book’ about vue and electron:
https://simulatedgreg.gitbooks.io/electron-vue/content/en/https://simulatedgreg.gitbooks.io/electron-vue/content/en/savingreading-local-files.html
Btw no emailing, otherwise other Quasar community members will not be able to see potential solutions.
-
@dobbel Thanks!
And Now I’ve already implemented my application in DEV mode !! but unfortunately…
I HAVE NO IDEA HOW TO BUILD IT !!In dev mode, I can see my system tray icon in status bar.
but after reading the documentation ( No offense but it is still not enough for how to build and package. just aquasar build -m electron
… )
I run the build command and everything seems fine.
but the production can’t show tray icon any more.
btw, inmain-process/electron.main.js
I used global variable__statics
is there anyone can help…
-
@tangmemgyu see the topic Tray icon not showing in production(Electron)