nw-img-vue
Caches copies of online images locally and loads them first if available
How this works:
In NW.js
- Checks for a local cached copy in Appliction Data folder (
window.nw.App.dataPath + '\nw-img-cache\'
) - If no local version exists, downloads the image to cache
- Always display image from cache (to prevent double-downloading)
In Browsers
- If
window.nw
orwindow.require
is not detected, just passes the URL directly into animg
tag. No caching is performed. Useful for codebases that are used for Web and Desktop builds.
Usage:
npm install --save nw-img-vue
- In
main.js
add this:;Vue; - In any
.vue
file add- Or this, depending on your setup.
- Or this, depending on your setup.
You can also just download the NwImg.vue
file directly from GitHub and drop it in your project. It is completely self-contained and requires no dependencies.