feat: implement url cleaner tool, local storage persistence and extension integration

This commit is contained in:
2026-02-27 06:14:43 +00:00
parent 7d989be27f
commit 204aeda00c
8 changed files with 772 additions and 326 deletions

View File

@@ -0,0 +1,18 @@
import { ref, watch } from 'vue'
export function useLocalStorage(key, defaultValue) {
// Initialize state from local storage or default value
const storedValue = localStorage.getItem(key)
const data = ref(storedValue ? JSON.parse(storedValue) : defaultValue)
// Watch for changes and update local storage
watch(data, (newValue) => {
if (newValue === null || newValue === undefined) {
localStorage.removeItem(key)
} else {
localStorage.setItem(key, JSON.stringify(newValue))
}
}, { deep: true })
return data
}