0👍
Yes as you said, localStorage
is perfectly fine to use it for this case.
Just bare in mind, that localStorage
is only stored in the current device that user is using. For example, if the user uses mobile and checks your announcement then the announcement will not be visible in mobile, but if user opens other device(laptop, etc..) then the announcement will pop up again.
In case you want always to know for all devices (for each user account) then this should be saved in a database and through an api endpoint to get this information and know when to show the announcement.
Add item in localstorage:
localStorage.setItem('YourItem', response.data)
You can fetch this using:
localStorage.getItem('YourItem')
To delete this from localStorage:
localStorage.removeItem('YourItem')
- [Vuejs]-Css grid showing only one column instead of repeat(5, 120px)
- [Vuejs]-How to make the dropdown options alphabetical using html, vue, js
Source:stackexchange.com