import { ref, watch } from 'vue' export type ZiniaoVersion = 'new' | 'old' const STORAGE_KEY = 'ziniao:version' function loadZiniaoVersion(): ZiniaoVersion { if (typeof window === 'undefined') return 'new' return window.localStorage.getItem(STORAGE_KEY) === 'old' ? 'old' : 'new' } export function useZiniaoVersion() { const ziniaoVersion = ref(loadZiniaoVersion()) watch(ziniaoVersion, (value) => { if (typeof window !== 'undefined') window.localStorage.setItem(STORAGE_KEY, value) }) return ziniaoVersion }