Vue Preload
How does it work
Like what InstantClick said, before visitors click on a link, they hover over that link. Between these two events, 200 ms to 300 ms usually pass by. InstantClick makes use of that time to preload the page, so that the page is already there when you click.
What the difference between InstantClick and Vue Preload is the latter preloads the data to store in state instead of replacing the HTML.
How simple it could be
First install with npm install vue-preload
and use the plugin, pretty neat huh?
Or even CDN: https://npmcdn.com/vue-preload@latest
Vue// with optionsVue
Protip: You can disable showProgress
and define your custom progress bar with onStart()
and onEnd()
Then replace your v-on:click="handleClick"
with v-preload="handleClick"
, and make a small change:
... { fetch}...
License
MIT.