How to monitor sessionStroage in vue project

there is a key such as flag in sessionStroage, how to listen for changes in its value. Is there any other way to access this data at regular intervals with a timer

Mar.09,2021

this kind of personal feeling should not be monitored. It is best to manually trigger the update yourself. When you save the flag key, submit the event trigger yourself. Like submitting mutation, in vuex If you have asynchronous operations, use action.


to understand your specific requirements, but the data in sessionStroage will not change on its own initiative. We can probably solve your requirements with this feature, that is, when the logic of your code executes the window.sessionStroage.setItem () method, execute your requirements logic or use vuex to set global calculation properties when When the variable changes, Synchronize stores the value of sessionStroage and performs some operations


without listening. Write subsequent logic when modifying the cache

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb9014-2723.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb9014-2723.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?