diff --git a/common/util.js b/common/util.js index 94ff495..c11dd17 100644 --- a/common/util.js +++ b/common/util.js @@ -36,3 +36,20 @@ export function getLink ({ slug, link, children }) { } return `/${slug}` } + +const PREF_KEY = 'veui.preferences' + +export function loadPref (key) { + try { + const pref = JSON.parse(localStorage.getItem(PREF_KEY)) + return pref[key] + } catch (e) { + return null + } +} + +export function savePref (key, value) { + const pref = JSON.parse(localStorage.getItem(PREF_KEY)) || {} + pref[key] = value + localStorage.setItem(PREF_KEY, JSON.stringify(pref)) +} diff --git a/components/OneLive.vue b/components/OneLive.vue index af29d5d..400d1ee 100644 --- a/components/OneLive.vue +++ b/components/OneLive.vue @@ -4,42 +4,57 @@ min-size="30" class="live-editor" > -
+ + +
Live
@@ -74,9 +89,10 @@