Vue.js Directive To Persist Input Values On Refresh – vue-rescue-input
A Vue JS directive to save your users form values so they are persisted if the browser is refreshed or the session is destroyed.
If you have ever tried losing your input values because of a random browser refresh or any other incident that was out of your control, you know how frustrating this is for the user experience. Saving the form values using localstorage has been a known UX enhancement for a long time, I could not find anything that worked for me with Vue JS, which is why I decided to create this directive.
Install the directive through npm
npm install vue-rescue-input, import it
import VueRescue from 'vue-rescue-input', then
use the directive by doing
On your inputs you will now be able to do
<input type="text" v-rescue-input> - your input will now be saved in localstorage - try to refresh your browser.
You can see a live demo of the directive here:
- Vue JS 2.*
TODO - See the Getting Started section for now
- Casper Sørensen -
Follow me on Twitter @csasorensen