mirror of
https://github.com/Spythere/station-manager-2.0.git
synced 2026-05-03 21:48:14 +00:00
feature: local storage
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { computed, watch } from 'vue';
|
||||
import { useStore } from '../store';
|
||||
|
||||
export default () => {
|
||||
const store = useStore();
|
||||
|
||||
const setupStorage = () => {
|
||||
// On mounted
|
||||
store.maxVisibleResults = Number(window.localStorage.getItem('maxVisibleResults')) || 30;
|
||||
|
||||
// Max vis. results
|
||||
watch(
|
||||
computed(() => store.maxVisibleResults),
|
||||
(v) => {
|
||||
window.localStorage.setItem('maxVisibleResults', v.toString());
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return {
|
||||
setupStorage,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user